hwmon: (nct6775) Additional check for ChipID before ASUS WMI usage
authorDenis Pauk <pauk.denis@gmail.com>
Sat, 18 Dec 2021 20:52:06 +0000 (22:52 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Sun, 26 Dec 2021 23:02:07 +0000 (15:02 -0800)
WMI monitoring methods can be changed or removed in new ASUS boards
BIOS versions. Such versions return zero instead of a real one as
Chip ID.

Commit adds additional validation for the result of Chip ID call
before enabling access by ASUS WMI methods.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204807
Signed-off-by: Denis Pauk <pauk.denis@gmail.com>
Link: https://lore.kernel.org/r/20211218205206.615865-1-pauk.denis@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/nct6775.c

index c585382..fd3f91c 100644 (file)
@@ -5038,7 +5038,7 @@ static int __init sensors_nct6775_init(void)
                                   board_name);
                if (err >= 0) {
                        /* if reading chip id via WMI succeeds, use WMI */
-                       if (!nct6775_asuswmi_read(0, NCT6775_PORT_CHIPID, &tmp)) {
+                       if (!nct6775_asuswmi_read(0, NCT6775_PORT_CHIPID, &tmp) && tmp) {
                                pr_info("Using Asus WMI to access %#x chip.\n", tmp);
                                access = access_asuswmi;
                        } else {