]> git.baikalelectronics.ru Git - kernel.git/commitdiff
hwmon: (emc6w201) Fix DIV_ROUND_CLOSEST problem with unsigned divisors
authorGuenter Roeck <linux@roeck-us.net>
Wed, 19 Dec 2012 02:16:08 +0000 (18:16 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Sat, 22 Dec 2012 10:16:40 +0000 (02:16 -0800)
Result of DIV_ROUND_CLOSEST is undefined for negative dividends if the divisor
variable type is unsigned. Fix by declaring divisor as signed variable.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
drivers/hwmon/emc6w201.c

index a98c917b5888f219ad219ebb7ed7b20d7d937dea..789bd4fb329b9b2eeca82b07751ab538b5c19e9a 100644 (file)
@@ -187,7 +187,7 @@ static struct emc6w201_data *emc6w201_update_device(struct device *dev)
  * Sysfs callback functions
  */
 
-static const u16 nominal_mv[6] = { 2500, 1500, 3300, 5000, 1500, 1500 };
+static const s16 nominal_mv[6] = { 2500, 1500, 3300, 5000, 1500, 1500 };
 
 static ssize_t show_in(struct device *dev, struct device_attribute *devattr,
        char *buf)