mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] hwmon: (nct6775) Additional check for ChipID before ASUS WMI usage
@ 2021-12-18 19:26 Denis Pauk
  2021-12-18 19:35 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Denis Pauk @ 2021-12-18 19:26 UTC (permalink / raw)
  Cc: andy.shevchenko, pauk.denis, platform-driver-x86, Guenter Roeck,
	Jean Delvare, linux-hwmon, linux-kernel

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>
---
 drivers/hwmon/nct6775.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
index 57ce8633a725..034347ed51c4 100644
--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -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
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] hwmon: (nct6775) Additional check for ChipID before ASUS WMI usage
  2021-12-18 19:26 [PATCH 1/1] hwmon: (nct6775) Additional check for ChipID before ASUS WMI usage Denis Pauk
@ 2021-12-18 19:35 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2021-12-18 19:35 UTC (permalink / raw)
  To: Denis Pauk
  Cc: andy.shevchenko, platform-driver-x86, Jean Delvare, linux-hwmon,
	linux-kernel

On 12/18/21 11:26 AM, Denis Pauk wrote:
> 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>
> ---
>   drivers/hwmon/nct6775.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
> index 57ce8633a725..034347ed51c4 100644
> --- a/drivers/hwmon/nct6775.c
> +++ b/drivers/hwmon/nct6775.c
> @@ -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

>   				pr_info("Using Asus WMI to access %#x chip.\n", tmp);
>   				access = access_asuswmi;
>   			} else {
> 
> base-commit: 2585cf9dfaaddf00b069673f27bb3f8530e2039c
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-18 19:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-18 19:26 [PATCH 1/1] hwmon: (nct6775) Additional check for ChipID before ASUS WMI usage Denis Pauk
2021-12-18 19:35 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®