removes unused variable from kernel/sysctl.h
PATCH 1/1 removes unused variable from kernel/sysctl.h
This patch removes the unused variable 'val' from the __do_proc_dointvec() function
in kernel/sysctl.h. The integer has been declared and used as 'val = -val' and there is
no reference to it anywhere.
Although I am this doesn't affects the kernel binary because gcc removes it, still it
might be confusing for people reading the code.
----
kernel/sysctl.c 2009-04-16 19:58:26.000000000 +0530 renamed from kernel/sysctl.c.orig 2009-04-16 19:57:21.000000000 +0530 +1 -3
@@ -2198,7 +2198,7 @@ static int __do_proc_dointvec(void *tbl_ void *data) { #define TMPBUFLEN 21 - int *i, vleft, first=1, neg, val; + int *i, vleft, first=1, neg; unsigned long lval; size_t left, len;
@@ -2251,8 +2251,6 @@ static int __do_proc_dointvec(void *tbl_ len = p-buf; if ((len < left) && *p && !isspace(*p)) break; - if (neg) - val = -val; s += len; left -= len;
Hello Sukanto,
Quoted 9 lines · Sukanto Ghosh
This patch removes the unused variable 'val' from the
__do_proc_dointvec()function
inkernel/sysctl.h. The integer has been declared and used as 'val = -val' and there is
no reference to it anywhere.
Although I am this doesn't affects the kernel binary because gcc removes it, still it
might be confusing for people reading the code.
This patch is already submitted by Tomohiro Kusumi on Thu Dec 27 2007:
http://lkml.indiana.edu/hypermail/linux/kernel/0712.3/0557.html
kernel/sysctl.c 2009-04-16 19:58:26.000000000 +0530 static int __do_proc_dointvec(void *tbl_ · line 2198
Quoted 9 lines
Signed-off-by Sukanto Ghosh <[email protected]>----
kernel/sysctl.c 2009-04-16 19:58:26.000000000 +0530 renamed from kernel/sysctl.c.orig 2009-04-16 19:57:21.000000000 +0530 +0
-0@@ -2198,7 +2198,7 @@ static int __do_proc_dointvec(void *tbl_ void *data)
This is a very old function and have almost no git history, its old name was do_proc_dointvec on 2005-04-16 15:20:36 when git tree was made and then only(almost) function name is changed.
kernel/sysctl.c 2009-04-16 19:58:26.000000000 +0530 static int __do_proc_dointvec(void *tbl_ · line 2255
Quoted 13 lines
kernel/sysctl.c 2009-04-16 19:58:26.000000000 +0530 renamed from kernel/sysctl.c.orig 2009-04-16 19:57:21.000000000 +0530 +1
-3{ #define TMPBUFLEN 21 - int *i, vleft, first=1, neg, val; + int *i, vleft, first=1, neg; unsigned long lval; size_t left, len;@@ -2251,8 +2251,6 @@ static int __do_proc_dointvec(void *tbl_ len = p-buf; if ((len < left) && *p && !isspace(*p)) break; - if (neg) - val = -val;
So you need to do further investigation. Is this a typo or some other mistake.
--
JSR
Hi,
Quoted 13 lines · Jaswinder Singh Rajput
Hello Sukanto,
Quoted 9 lines · Sukanto Ghosh
This patch removes the unused variable 'val' from the
__do_proc_dointvec()function
inkernel/sysctl.h. The integer has been declared and used as 'val = -val' and there is
no reference to it anywhere.
Although I am this doesn't affects the kernel binary because gcc removes it, still it
might be confusing for people reading the code.
Quoted 3 lines
This patch is already submitted by Tomohiro Kusumi on Thu Dec 27 2007:
http://lkml.indiana.edu/hypermail/linux/kernel/0712.3/0557.html
I asked Tomohiro regarding this and got the following reply:
----
I think they just missed that patch since I found my name on the following page regarding this patch.
http://lkml.org/lkml/2008/5/30/335
I think it's obvious that the val is unnecessary and someone probably just forgot to remove it when they cleaned up that code.
-----
Quoted 22 lines
kernel/sysctl.c 2009-04-16 19:58:26.000000000 +0530 static int __do_proc_dointvec(void *tbl_ · line 2198
Quoted 10 lines
Signed-off-by Sukanto Ghosh <[email protected]>----
kernel/sysctl.c 2009-04-16 19:58:26.000000000 +0530 renamed from kernel/sysctl.c.orig 2009-04-16 19:57:21.000000000 +0530 +0
-0@@ -2198,7 +2198,7 @@ static int __do_proc_dointvec(void *tbl_ void *data)This is a very old function and have almost no git history, its old name was
do_proc_dointvecon 2005-04-16 15:20:36 when git tree was made and then only(almost) function name is changed.Quoted 7 lines
kernel/sysctl.c 2009-04-16 19:58:26.000000000 +0530 renamed from kernel/sysctl.c.orig 2009-04-16 19:57:21.000000000 +0530 +1
-1{ #define TMPBUFLEN 21 - int *i, vleft, first=1, neg, val; + int *i, vleft, first=1, neg; unsigned long lval; size_t left, len;
Quoted 9 lines
kernel/sysctl.c 2009-04-16 19:58:26.000000000 +0530 static int __do_proc_dointvec(void *tbl_ · line 2255
Quoted 6 lines
kernel/sysctl.c 2009-04-16 19:58:26.000000000 +0530 renamed from kernel/sysctl.c.orig 2009-04-16 19:57:21.000000000 +0530 +0
-2@@ -2251,8 +2251,6 @@ static int __do_proc_dointvec(void *tbl_ len = p-buf; if ((len < left) && *p && !isspace(*p)) break; - if (neg) - val = -val;So you need to do further investigation. Is this a typo or some other mistake.
Considering that this function is currently working properly and the variable 'val' is not used anywhere, it is obvious that removing the variable will not affect the functionality of the function in any manner.
It seems that either people haven't noticed this unused variable before Tomohiro did, or they did not see merit in submitting the trivial patch. But I believe such code cleanups are required.
If you (maintainers) feel that it is worth it, should I re-submit the patch ?
Signature · 2 lines
Regards, Sukanto Ghosh
Quoted 26 lines · Sukanto Ghosh
This patch removes the unused variable 'val' from the
__do_proc_dointvec()function
inkernel/sysctl.h. The integer has been declared and used as 'val = -val' and there is
no reference to it anywhere.
Although I am this doesn't affects the kernel binary because gcc removes it, still it
might be confusing for people reading the code.Signed-off-by Sukanto Ghosh <[email protected]>----
kernel/sysctl.c 2009-04-16 19:58:26.000000000 +0530 renamed from kernel/sysctl.c.orig 2009-04-16 19:57:21.000000000 +0530 +1
-1@@ -2198,7 +2198,7 @@ static int __do_proc_dointvec(void *tbl_ void *data) { #define TMPBUFLEN 21 - int *i, vleft, first=1, neg, val; + int *i, vleft, first=1, neg; unsigned long lval; size_t left, len;
kernel/sysctl.c 2009-04-16 19:58:26.000000000 +0530 static int __do_proc_dointvec(void *tbl_ · line 2255
Quoted 7 lines
kernel/sysctl.c 2009-04-16 19:58:26.000000000 +0530 renamed from kernel/sysctl.c.orig 2009-04-16 19:57:21.000000000 +0530 +0
-2@@ -2251,8 +2251,6 @@ static int __do_proc_dointvec(void *tbl_ len = p-buf; if ((len < left) && *p && !isspace(*p)) break; - if (neg) - val = -val; s += len; left -= len;
This doesn't seem to be picked up by anyone, CCing akpm.
Signature · 2 lines
Jiri Kosina SUSE Labs