]> git.baikalelectronics.ru Git - kernel.git/commit
HID: asus: fix build warning wiht CONFIG_ASUS_WMI disabled
authorArnd Bergmann <arnd@arndb.de>
Fri, 2 Nov 2018 15:14:32 +0000 (16:14 +0100)
committerJiri Kosina <jkosina@suse.cz>
Tue, 6 Nov 2018 12:57:42 +0000 (13:57 +0100)
commit3fc202e81db70bf60beb9296eefd4e48d6304607
tree3900c89db4a74de4d662970f72b7fe7bab52f974
parent0c7244209588630a9b45e52490ef1390e04499a6
HID: asus: fix build warning wiht CONFIG_ASUS_WMI disabled

asus_wmi_evaluate_method() is an empty dummy function when CONFIG_ASUS_WMI
is disabled, or not reachable from a built-in device driver. This leads to
a theoretical evaluation of an uninitialized variable that the compiler
complains about, failing to check that the hardcoded return value makes
this an unreachable code path:

In file included from include/linux/printk.h:336,
                 from include/linux/kernel.h:14,
                 from include/linux/list.h:9,
                 from include/linux/dmi.h:5,
                 from drivers/hid/hid-asus.c:29:
drivers/hid/hid-asus.c: In function 'asus_input_configured':
include/linux/dynamic_debug.h:135:3: error: 'value' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   __dynamic_dev_dbg(&descriptor, dev, fmt, \
   ^~~~~~~~~~~~~~~~~
drivers/hid/hid-asus.c:359:6: note: 'value' was declared here
  u32 value;
      ^~~~~

With an extra IS_ENABLED() check, the warning goes away.

Fixes: 3b692c55e58d ("HID: asus: only support backlight when it's not driven by WMI")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-asus.c