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.
Unified · Split
| @@ -359,6 +359,9 @@ static bool asus_kbd_wmi_led_control_present(struct hid_device *hdev) · 358 unmodified lines | ||
| 359 | 359 | u32 value; |
| 360 | 360 | int ret; |
| 361 | 361 | |
| 362 | + if (!IS_ENABLED(CONFIG_ASUS_WMI)) | |
| 363 | + return false; | |
| 364 | + | |
| 362 | 365 | ret = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS2, |
| 363 | 366 | ASUS_WMI_DEVID_KBD_BACKLIGHT, 0, &value); |
| 364 | 367 | hid_dbg(hdev, "WMI backlight check: rc %d value %x", ret, value); |