Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

asus-wmi: fix error handling in store_sys_wmi()

The asus_wmi_get_devstate_simple() returns 0-1 on success. In theory
according to static checkers, it can return either -EIO or -ENODEV on
failure. Currently the error handling code only handles -ENODEV and
-EIO is treated as success. Let's make it handle the -EIO error as
well.

It's possible that it can't actually return -EIO and this patch is not
needed but in that case this patch is harmless and silences a static
checker warning so it's still worth it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>

authored by

Dan Carpenter and committed by
Darren Hart
b8298340 f71c882d

+1 -1
+1 -1
drivers/platform/x86/asus-wmi.c
··· 1682 1682 int rv, err, value; 1683 1683 1684 1684 value = asus_wmi_get_devstate_simple(asus, devid); 1685 - if (value == -ENODEV) /* Check device presence */ 1685 + if (value < 0) 1686 1686 return value; 1687 1687 1688 1688 rv = parse_arg(buf, count, &value);