platform/x86: intel_pmc_ipc: Propagate error from kstrtoul()
authorMika Westerberg <mika.westerberg@linux.intel.com>
Wed, 22 Jan 2020 16:46:18 +0000 (19:46 +0300)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 22 Jan 2020 16:52:27 +0000 (18:52 +0200)
kstrtoul() already returns negative error if the input was not valid so
return it directly.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/platform/x86/intel_pmc_ipc.c

index b870360..7b180ea 100644 (file)
@@ -512,8 +512,9 @@ static ssize_t intel_pmc_ipc_northpeak_store(struct device *dev,
        int subcmd;
        int ret;
 
-       if (kstrtoul(buf, 0, &val))
-               return -EINVAL;
+       ret = kstrtoul(buf, 0, &val);
+       if (ret)
+               return ret;
 
        if (val)
                subcmd = 1;