hwmon: (f71805f) Fix clamping of temperature limits
Subsystems (2)
PATCH 1/1 hwmon: (f71805f) Fix clamping of temperature limits
Properly clamp temperature limits set by the user. Without this fix, attempts to write temperature limits above the maximum supported by the chip (255 degrees Celsius) would arbitrarily and unexpectedly result in the limit being set to 0 degree Celsius.
--- drivers/hwmon/f71805f.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/hwmon/f71805f.c +4 -4
@@ -283,10 +283,10 @@ static inline long temp_from_reg(u8 reg)static inline u8 temp_to_reg (long val) { -if (val <0 ) - val =0 ; -else if (val >1000 *0xff ) - val =0xff ; +if (val <=0 ) +return 0 ; +if (val >=1000 *0xff ) +return 0xff ;return (val +500 ) /1000 ; }
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 7 lines · Jean Delvare
Properly clamp temperature limits set by the user. Without this fix, attempts to write temperature limits above the maximum supported by the chip (255 degrees Celsius) would arbitrarily and unexpectedly result in the limit being set to 0 degree Celsius.
Signed-off-by Jean Delvare <[email protected]>
Good catch. Applied.
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 10 lines · Guenter Roeck
Quoted 7 lines · Jean Delvare
Properly clamp temperature limits set by the user. Without this fix, attempts to write temperature limits above the maximum supported by the chip (255 degrees Celsius) would arbitrarily and unexpectedly result in the limit being set to 0 degree Celsius.
Signed-off-by Jean Delvare <[email protected]>Good catch. Applied.
Note that this patch conflicts with one of yours. For smooth integration in stable trees it would be best to apply mine first and yours on top. If you can't be bothered, you can also drop all f71805f patches and I'll handle them, just let me know.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 10 lines · Jean Delvare
Quoted 9 lines · Guenter Roeck
Quoted 7 lines · Jean Delvare
Properly clamp temperature limits set by the user. Without this fix, attempts to write temperature limits above the maximum supported by the chip (255 degrees Celsius) would arbitrarily and unexpectedly result in the limit being set to 0 degree Celsius.
Signed-off-by Jean Delvare <[email protected]>
Quoted 7 lines
Quoted 1 line
Good catch. Applied.
Note that this patch conflicts with one of yours. For smooth integration in stable trees it would be best to apply mine first and yours on top. If you can't be bothered, you can also drop all f71805f patches and I'll handle them, just let me know.
No problem; thanks for the note. Fixed it already, by moving your patch to the head of my patch list.
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors