]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Staging: lustre: lproc_osc: Change the variable to be checked
authorShivani Bhardwaj <shivanib134@gmail.com>
Thu, 15 Oct 2015 20:06:31 +0000 (01:36 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Oct 2015 05:34:06 +0000 (22:34 -0700)
The variable rc is supposed to hold the value returned by function
kstrtoul which can either be 0, -EINVAL (-22) or -ERANGE (-34).
Therefore, the check must be performed on rc instead of val for error
values. Also, rc can never be greater than 0.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/osc/lproc_osc.c

index 053d5088f02fc907311911bfe19652d5527b5fe0..cdc7f889564eb6a5da7fd2f5bf27ce33ba657cce 100644 (file)
@@ -61,9 +61,7 @@ static ssize_t active_store(struct kobject *kobj, struct attribute *attr,
        unsigned long val;
 
        rc = kstrtoul(buffer, 10, &val);
-       if (rc)
-               return rc;
-       if (val < 0 || val > 1)
+       if (rc < 0)
                return -ERANGE;
 
        /* opposite senses */