fs/proc/generic.c: delete useless "len" variable
authorAlexey Dobriyan <adobriyan@gmail.com>
Thu, 5 Dec 2019 00:50:02 +0000 (16:50 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 5 Dec 2019 03:44:11 +0000 (19:44 -0800)
Pointer to next '/' encodes length of path element and next start
position.  Subtraction and increment are redundant.

Link: http://lkml.kernel.org/r/20191004234521.GA30246@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/generic.c

index d4f3531..074e958 100644 (file)
@@ -163,7 +163,6 @@ static int __xlate_proc_name(const char *name, struct proc_dir_entry **ret,
 {
        const char              *cp = name, *next;
        struct proc_dir_entry   *de;
-       unsigned int            len;
 
        de = *ret;
        if (!de)
@@ -174,13 +173,12 @@ static int __xlate_proc_name(const char *name, struct proc_dir_entry **ret,
                if (!next)
                        break;
 
-               len = next - cp;
-               de = pde_subdir_find(de, cp, len);
+               de = pde_subdir_find(de, cp, next - cp);
                if (!de) {
                        WARN(1, "name '%s'\n", name);
                        return -ENOENT;
                }
-               cp += len + 1;
+               cp = next + 1;
        }
        *residual = cp;
        *ret = de;