asus-laptop: correct error handling in sysfs_acpi_set
authorGiedrius Statkevičius <giedrius.statkevicius@gmail.com>
Sat, 16 Apr 2016 00:01:57 +0000 (03:01 +0300)
committerDarren Hart <dvhart@linux.intel.com>
Mon, 25 Apr 2016 17:42:54 +0000 (10:42 -0700)
Properly return rv back to the caller in the case of an error in
parse_arg. In the process remove a unused variable 'out'.

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
drivers/platform/x86/asus-laptop.c

index 223090c9d433bc90fdd815da14b541adc5dab3ff..15f1311465015c72fcc82210a15df0bb24532928 100644 (file)
@@ -948,11 +948,10 @@ static ssize_t sysfs_acpi_set(struct asus_laptop *asus,
                              const char *method)
 {
        int rv, value;
-       int out = 0;
 
        rv = parse_arg(buf, count, &value);
-       if (rv > 0)
-               out = value ? 1 : 0;
+       if (rv <= 0)
+               return rv;
 
        if (write_acpi_int(asus->handle, method, value))
                return -ENODEV;