hwmon: (smsc47m192) Fix temperature limit and vrm write operations
commit 043572d5 upstream. Temperature limit clamps are applied after converting the temperature from milli-degrees C to degrees C, so either the clamp limit needs to be specified in degrees C, not milli-degrees C, or clamping must happen before converting to degrees C. Use the latter method to avoid overflows. vrm is an u8, so the written value needs to be limited to [0, 255]. Cc: Axel Lin <axel.lin@ingics.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <jdelvare@suse.de> [bwh: Backported to 3.2: - Driver is not using clamp_val(); keep using SENSORS_LIMIT() for consistency - Driver is not using kstrtoul(); make the minimum change to set_vrm() so we can validate the value before assigning] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Showing
Please register or sign in to comment