]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
hwmon: (dell-smm) Fix off-by-one error in dell_smm_is_visible()
authorArmin Wolf <W_Armin@gmx.de>
Wed, 3 Dec 2025 20:21:09 +0000 (21:21 +0100)
committerGuenter Roeck <linux@roeck-us.net>
Sun, 7 Dec 2025 22:10:18 +0000 (14:10 -0800)
The documentation states that on machines supporting only global
fan mode control, the pwmX_enable attributes should only be created
for the first fan channel (pwm1_enable, aka channel 0).

Fix the off-by-one error caused by the fact that fan channels have
a zero-based index.

Cc: stable@vger.kernel.org
Fixes: 1c1658058c99 ("hwmon: (dell-smm) Add support for automatic fan mode")
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20251203202109.331528-1-W_Armin@gmx.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/dell-smm-hwmon.c

index 683baf361c4c8469773f76a8638ae6ebcba6e39f..a34753fc29733a9e00f1b580eb8bf059db4d4d1a 100644 (file)
@@ -861,9 +861,9 @@ static umode_t dell_smm_is_visible(const void *drvdata, enum hwmon_sensor_types
                        if (auto_fan) {
                                /*
                                 * The setting affects all fans, so only create a
-                                * single attribute.
+                                * single attribute for the first fan channel.
                                 */
-                               if (channel != 1)
+                               if (channel != 0)
                                        return 0;
 
                                /*