Skip to contentSkip to conversation

hwmon: (it87) Fix pwm frequency display

PATCH New Guenter Roeck 1 participant 1 message Apr 4, 2015

Subsystems (2)
lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 1/1 hwmon: (it87) Fix pwm frequency display

Commit 687c68dd7955 ("hwmon: (it87) Fix PWM frequency display for chips with newer PWM control") tried to fix pwm frequency display but got operator precedence all wrong, resulting in a pwm frequency display of 256 or, with older chips, a division by zero.

---
I might actually fold this one into the original patch, given the severeness of the problem.

 drivers/hwmon/it87.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/it87.c +1 -1
index 2c2d945e47e3..b70227108cb8 100644
@@ -1085,7 +1085,7 @@ static ssize_t show_pwm_freq(struct device *dev, struct device_attribute *attr,
 	else
 		index = (data->fan_ctl >> 4) & 0x07;
 
-	freq = pwm_freq[index] / has_newer_autopwm(data) ? 256 : 128;
+	freq = pwm_freq[index] / (has_newer_autopwm(data) ? 256 : 128);
 
 	return sprintf(buf, "%u\n", freq);
 }
Signature · 7 lines
2.1.0


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