Skip to contentSkip to conversation

hwmon: (it87) Fix pwm sysfs attribute removal

PATCH In review Guenter Roeck 2 participants 2 messages Mar 30, 2015

Subsystems (2)
lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 2/15 hwmon: (it87) Fix pwm sysfs attribute removal

Detection if a pwm channel is supported was wrong on removal, causing the code to try removing non-existing sysfs attributes. That didn't matter much because sysfs attribute removal of non-existing files fails silently, and because the wrong evaluation always returned false, but should nevertheless be fixed.

---
 drivers/hwmon/it87.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/it87.c +1 -1
index 7ab5bd026e91..180750ef6156 100644
@@ -2095,7 +2095,7 @@ static void it87_remove_files(struct device *dev)
 					  it87_attributes_fan_div[i]);
 	}
 	for (i = 0; i < 3; i++) {
-		if (sio_data->skip_pwm & (1 << 0))
+		if (sio_data->skip_pwm & (1 << i))
 			continue;
 		sysfs_remove_group(&dev->kobj, &it87_group_pwm[i]);
 		if (has_old_autopwm(data))
Signature · 7 lines
2.1.0


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Reviewed-by on v1 2/15
#1 lore raw
Quoted 16 lines · Guenter Roeck

Detection if a pwm channel is supported was wrong on removal, causing the code to try removing non-existing sysfs attributes. That didn't matter much because sysfs attribute removal of non-existing files fails silently, and because the wrong evaluation always returned false, but should nevertheless be fixed.

---
 drivers/hwmon/it87.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/it87.c +0 -0
index 7ab5bd026e91..180750ef6156 100644

drivers/hwmon/it87.c static void it87_remove_files(struct device *dev) · line 2101

Quoted 8 lines
drivers/hwmon/it87.c +1 -1
@@ -2095,7 +2095,7 @@ static void it87_remove_files(struct device *dev)
 					  it87_attributes_fan_div[i]);
 	}
 	for (i = 0; i < 3; i++) {
-		if (sio_data->skip_pwm & (1 << 0))
+		if (sio_data->skip_pwm & (1 << i))
 			continue;
 		sysfs_remove_group(&dev->kobj, &it87_group_pwm[i]);
 		if (has_old_autopwm(data))

Bah, you can blame me for that one :( Good catch.

Signature · 7 lines
Jean Delvare
SUSE L3 Support

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors