Skip to content

Commit

Permalink
hwmon: (emc6w201) Fix DIV_ROUND_CLOSEST problem with unsigned divisors
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Guenter Roeck committed Dec 22, 2012
1 parent 0602934 commit 86266ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hwmon/emc6w201.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 86266ca

Please sign in to comment.