hwmon: (smsc47m192) Fix temperature limit and vrm write operations
authorGuenter Roeck <linux@roeck-us.net>
Fri, 18 Jul 2014 14:31:18 +0000 (07:31 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 31 Jul 2014 19:53:51 +0000 (12:53 -0700)
commit69d15f41f7ee1ae8694511a1f134174ec1ffa337
treefb414c08e60f43bb1ab950bc565592e8a9531922
parentc423ba6f8e807b1d18baa729a58e52f625406d1e
hwmon: (smsc47m192) Fix temperature limit and vrm write operations

commit 043572d5444116b9d9ad8ae763cf069e7accbc30 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwmon/smsc47m192.c