Skip to contentSkip to conversation

hwmon: (nct6775) Additional check for ChipID before ASUS WMI usage

PATCH Superseded Denis Pauk 2 participants 2 messages Dec 18, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Denis Pauk

author
#0 lore raw

PATCH 1/1 hwmon: (nct6775) Additional check for ChipID before ASUS WMI usage

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.

---
 drivers/hwmon/nct6775.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hwmon/nct6775.c +2 -1
index 57ce8633a725..034347ed51c4 100644
@@ -5038,7 +5038,8 @@ 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 {

base-commit: 2585cf9dfaaddf00b069673f27bb3f8530e2039c

Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 18 lines · Denis Pauk

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.

---
  drivers/hwmon/nct6775.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hwmon/nct6775.c +0 -0
index 57ce8633a725..034347ed51c4 100644

drivers/hwmon/nct6775.c static int __init sensors_nct6775_init(void) · line 5042

Quoted 6 lines
drivers/hwmon/nct6775.c +2 -1
@@ -5038,7 +5038,8 @@ 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) {

Please drop the continuation line; the above hurts readability, and in that case up to 100 columns are allowed.

Thanks,
Guenter

Quoted 6 lines
drivers/hwmon/nct6775.c +0 -0
  				pr_info("Using Asus WMI to access %#x chip.\n", tmp);
  				access = access_asuswmi;
  			} else {

base-commit: 2585cf9dfaaddf00b069673f27bb3f8530e2039c