Skip to contentSkip to conversation

FAILED: patch "[PATCH] hwmon: (nct6775) Fix target temp and tolerance for" failed to apply to 6.1-stable tree

PATCH New [email protected] 2 participants 5 messages Dec 2 – Dec 4

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 73d857b33cdfaf35f8d3f833b36745d91c18db13
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026120242-flick-armful-dbb4@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 73d857b33cdfaf35f8d3f833b36745d91c18db13 Mon Sep 17 00:00:00 2001
From: Guenter Roeck <[email protected]>
Date: Mon, 9 Nov 2026 17:54:35 -0800
Subject: [PATCH] hwmon: (nct6775) Fix target temp and tolerance for
NCT6106/6116/6126

In nct6775_probe(), the nct6106, nct6116, and nct6126 chip cases leave target_temp_mask, tolerance_mask, and speed_tolerance_limit zero-initialized.

As a result, reading pwm*_target_temp from sysfs always returns 0, writing to pwm*_target_temp, pwm*_temp_tolerance, pwm*_crit_temp_tolerance, or fan*_tolerance clamps user-supplied values to 0, and pwm_update_registers() fails to clear existing tolerance bits in REG_FAN_MODE when updating fan control modes.

Initialize target_temp_mask to 0xff, tolerance_mask to 0x07, and speed_tolerance_limit to 63 for NCT6106, NCT6116, and NCT6126, matching the hardware register layout shared with NCT5525 and NCT6776+.

Fixes 6c009501ff20 ("hwmon: (nct6775) Add support for NCT6102D/6106D")
Fixes 29c7cb485b32 ("hwmon: (nct6775) Integrate new model nct6116")
Fixes 437b3c2a4bdc ("hwmon: (nct6775) Add support for NCT6126D")
Cc Anton Lundin <[email protected]>
drivers/hwmon/nct6775-core.c +9 -0
index ac6f3f0ca2b3..123d62a87a43 100644
@@ -3572,6 +3572,9 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data,
 
 		data->fan_from_reg = fan_from_reg13;
 		data->fan_from_reg_min = fan_from_reg13;
+		data->target_temp_mask = 0xff;
+		data->tolerance_mask = 0x07;
+		data->speed_tolerance_limit = 63;
 
 		data->temp_label = nct6776_temp_label;
 		data->temp_mask = NCT6776_TEMP_MASK;
@@ -3648,6 +3651,9 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data,
 
 		data->fan_from_reg = fan_from_reg13;
 		data->fan_from_reg_min = fan_from_reg13;
+		data->target_temp_mask = 0xff;
+		data->tolerance_mask = 0x07;
+		data->speed_tolerance_limit = 63;
 
 		data->temp_label = nct6776_temp_label;
 		data->temp_mask = NCT6776_TEMP_MASK;
@@ -3725,6 +3731,9 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data,
 
 		data->fan_from_reg = fan_from_reg13;
 		data->fan_from_reg_min = fan_from_reg13;
+		data->target_temp_mask = 0xff;
+		data->tolerance_mask = 0x07;
+		data->speed_tolerance_limit = 63;
 
 		data->temp_label = nct6776_temp_label;
 		data->temp_mask = NCT6776_TEMP_MASK;
maintainer
#1 lore raw

PATCH 1/4 hwmon: (nct6775) Change labels for nct6799

From: Ahmad Khalifa <[email protected]>

[ Upstream commit 23299bba08dfb7037877edcc430c907f0522c856 ]

nct6799d-r and nct6796d-s are very similar and chip_id is only different in the version nibblet.

Since both will be detected by the driver anyway due to the chipid mask, they should be labeled together for dmesg msg.

Stable-dep-of: 73d857b33cdf ("hwmon: (nct6775) Fix target temp and tolerance for NCT6106/6116/6126")

---
 Documentation/hwmon/nct6775.rst  | 11 ++++++++++-
 drivers/hwmon/nct6775-core.c     |  3 ++-
 drivers/hwmon/nct6775-platform.c |  2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)
Documentation/hwmon/nct6775.rst +10 -1
index 5ba8276aad4b8..9d7a10de61a76 100644
@@ -80,7 +80,13 @@ Supported chips:
 
     Datasheet: Available from Nuvoton upon request
 
+  * Nuvoton NCT6796D-S/NCT6799D-R
 
+    Prefix: 'nct6799'
+
+    Addresses scanned: ISA address retrieved from Super I/O registers
+
+    Datasheet: Available from Nuvoton upon request
 
 Authors:
 
@@ -277,4 +283,7 @@ will not reflect a usable value. It often reports unreasonably high
 temperatures, and in some cases the reported temperature declines if the actual
 temperature increases (similar to the raw PECI temperature value - see PECI
 specification for details). CPUTIN should therefore be ignored on ASUS
-boards. The CPU temperature on ASUS boards is reported from PECI 0.
+boards. The CPU temperature on ASUS boards is reported from PECI 0 or TSI 0.
+
+NCT6796D-S and NCT6799D-R chips are very similar and their chip_id indicates
+they are different versions. This driver treats them the same way.
drivers/hwmon/nct6775-core.c +2 -1
index b7f9bceedb7b0..62545e1867977 100644
@@ -33,7 +33,8 @@
  *                                           (0xd451)
  * nct6798d    14      7       7       2+6    0xd428 0xc1    0x5ca3
  *                                           (0xd429)
- * nct6799d    14      7       7       2+6    0xd802 0xc1    0x5ca3
+ * nct6796d-s  18      7       7       6+2    0xd801 0xc1    0x5ca3
+ * nct6799d-r  18      7       7       6+2    0xd802 0xc1    0x5ca3
  *
  * #temp lists the number of monitored temperature sources (first value) plus
  * the number of directly connectable temperature sensors (second value).
drivers/hwmon/nct6775-platform.c +1 -1
index f43cb418c0338..9e68c99250afc 100644
@@ -35,7 +35,7 @@ static const char * const nct6775_sio_names[] __initconst = {
 	"NCT6796D",
 	"NCT6797D",
 	"NCT6798D",
-	"NCT6799D",
+	"NCT6796D-S/NCT6799D-R",
 };
 
 static unsigned short force_id;
Signature · 1 line
2.53.0
maintainer
#2 lore raw

PATCH 2/4 hwmon: (nct6775-platform) Explicitly initialize nct6775_sio_names indexes

From: Kees Cook <[email protected]>

[ Upstream commit efe86092ab316db8d3c6e98f57b193511a09a073 ]

Changing the "kinds" enum start value to be 1-indexed instead of 0-indexed caused look-ups in nct6775_sio_namesp[] to be misaligned or off the end. Coverity reported:

*** CID 1571052: Memory - illegal accesses (OVERRUN) drivers/hwmon/nct6775-platform.c:1075 in nct6775_find()

1069                sio_data->kind == nct6793 || sio_data->kind == nct6795 ||
1070                sio_data->kind == nct6796 || sio_data->kind == nct6797 ||
1071                sio_data->kind == nct6798 || sio_data->kind == nct6799)

1072 nct6791_enable_io_mapping(sio_data);
1073
1074 sio_data->sio_exit(sio_data);
vvv CID 1571052: Memory - illegal accesses (OVERRUN)
vvv Overrunning array "nct6775_sio_names" of 13 8-byte elements at element index 13 (byte offset 111) using index "sio_data->kind" (which evaluates to 13).
1075 pr_info("Found %s or compatible chip at %#x:%#x\n",
1076 nct6775_sio_names[sio_data->kind], sioaddr, addr);
1077
1078 return addr;
1079 }
1080

Initialize the string list with explicit indexes.

Cc Guenter Roeck <[email protected]>
Cc Rob Herring <[email protected]>
Cc Jean Delvare <[email protected]>
Fixes 10a0575ea09d ("hwmon: nct6775-i2c: Use i2c_get_match_data()")

Stable-dep-of: 73d857b33cdf ("hwmon: (nct6775) Fix target temp and tolerance for NCT6106/6116/6126")

---
 drivers/hwmon/nct6775-platform.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/hwmon/nct6775-platform.c +13 -13
index 9e68c99250afc..0631898a30703 100644
@@ -23,19 +23,19 @@
 enum sensor_access { access_direct, access_asuswmi };
 
 static const char * const nct6775_sio_names[] __initconst = {
-	"NCT6106D",
-	"NCT6116D",
-	"NCT6775F",
-	"NCT6776D/F",
-	"NCT6779D",
-	"NCT6791D",
-	"NCT6792D",
-	"NCT6793D",
-	"NCT6795D",
-	"NCT6796D",
-	"NCT6797D",
-	"NCT6798D",
-	"NCT6796D-S/NCT6799D-R",
+	[nct6106] = "NCT6106D",
+	[nct6116] = "NCT6116D",
+	[nct6775] = "NCT6775F",
+	[nct6776] = "NCT6776D/F",
+	[nct6779] = "NCT6779D",
+	[nct6791] = "NCT6791D",
+	[nct6792] = "NCT6792D",
+	[nct6793] = "NCT6793D",
+	[nct6795] = "NCT6795D",
+	[nct6796] = "NCT6796D",
+	[nct6797] = "NCT6797D",
+	[nct6798] = "NCT6798D",
+	[nct6799] = "NCT6796D-S/NCT6799D-R",
 };
 
 static unsigned short force_id;
Signature · 1 line
2.53.0
maintainer
#3 lore raw

PATCH 3/4 hwmon: (nct6775-core) Explicitly initialize nct6775_device_names indexes

In reply to Sasha Levin

From: Guenter Roeck <[email protected]>

[ Upstream commit 2792fc8f8c834e035b09be42d445085bd8bcac7e ]

Changing the "kinds" enum start value to be 1-indexed instead of 0-indexed caused look-ups in nct6775_device_names[] to be misaligned or off the end.

Initialize the string list with explicit indexes.

Cc Rob Herring <[email protected]>
Cc Kees Cook <[email protected]>
Fixes 10a0575ea09d ("hwmon: nct6775-i2c: Use i2c_get_match_data()")

Stable-dep-of: 73d857b33cdf ("hwmon: (nct6775) Fix target temp and tolerance for NCT6106/6116/6126")

---
 drivers/hwmon/nct6775-core.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/hwmon/nct6775-core.c +13 -13
index 62545e1867977..5f335a2046ad2 100644
@@ -63,19 +63,19 @@
 
 /* used to set data->name = nct6775_device_names[data->sio_kind] */
 static const char * const nct6775_device_names[] = {
-	"nct6106",
-	"nct6116",
-	"nct6775",
-	"nct6776",
-	"nct6779",
-	"nct6791",
-	"nct6792",
-	"nct6793",
-	"nct6795",
-	"nct6796",
-	"nct6797",
-	"nct6798",
-	"nct6799",
+	[nct6106] = "nct6106",
+	[nct6116] = "nct6116",
+	[nct6775] = "nct6775",
+	[nct6776] = "nct6776",
+	[nct6779] = "nct6779",
+	[nct6791] = "nct6791",
+	[nct6792] = "nct6792",
+	[nct6793] = "nct6793",
+	[nct6795] = "nct6795",
+	[nct6796] = "nct6796",
+	[nct6797] = "nct6797",
+	[nct6798] = "nct6798",
+	[nct6799] = "nct6799",
 };
 
 /* Common and NCT6775 specific data */
Signature · 1 line
2.53.0
maintainer
#4 lore raw

PATCH 4/4 hwmon: (nct6775) Fix target temp and tolerance for NCT6106/6116/6126

In reply to Sasha Levin

From: Guenter Roeck <[email protected]>

[ Upstream commit 73d857b33cdfaf35f8d3f833b36745d91c18db13 ]

In nct6775_probe(), the nct6106, nct6116, and nct6126 chip cases leave target_temp_mask, tolerance_mask, and speed_tolerance_limit zero-initialized.

As a result, reading pwm*_target_temp from sysfs always returns 0, writing to pwm*_target_temp, pwm*_temp_tolerance, pwm*_crit_temp_tolerance, or fan*_tolerance clamps user-supplied values to 0, and pwm_update_registers() fails to clear existing tolerance bits in REG_FAN_MODE when updating fan control modes.

Initialize target_temp_mask to 0xff, tolerance_mask to 0x07, and speed_tolerance_limit to 63 for NCT6106, NCT6116, and NCT6126, matching the hardware register layout shared with NCT5525 and NCT6776+.

Fixes 6c009501ff20 ("hwmon: (nct6775) Add support for NCT6102D/6106D")
Fixes 29c7cb485b32 ("hwmon: (nct6775) Integrate new model nct6116")
Fixes 437b3c2a4bdc ("hwmon: (nct6775) Add support for NCT6126D")
Cc Anton Lundin <[email protected]>
[ sashal: Dropped the duplicate hunk that upstream applied to a second chip case, since that block doesn't exist in this tree, so the mask and tolerance assignments land only in the one remaining case. ]
---
 drivers/hwmon/nct6775-core.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/hwmon/nct6775-core.c +6 -0
index 5f335a2046ad2..3f7f6c8923e07 100644
@@ -3531,6 +3531,9 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data,
 
 		data->fan_from_reg = fan_from_reg13;
 		data->fan_from_reg_min = fan_from_reg13;
+		data->target_temp_mask = 0xff;
+		data->tolerance_mask = 0x07;
+		data->speed_tolerance_limit = 63;
 
 		data->temp_label = nct6776_temp_label;
 		data->temp_mask = NCT6776_TEMP_MASK;
@@ -3607,6 +3610,9 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data,
 
 		data->fan_from_reg = fan_from_reg13;
 		data->fan_from_reg_min = fan_from_reg13;
+		data->target_temp_mask = 0xff;
+		data->tolerance_mask = 0x07;
+		data->speed_tolerance_limit = 63;
 
 		data->temp_label = nct6776_temp_label;
 		data->temp_mask = NCT6776_TEMP_MASK;
Signature · 1 line
2.53.0