summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm87.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-09-26 22:16:56 +0200
committerMark M. Hoffman <mhoffman@lightlink.com>2007-10-10 04:56:31 +0200
commitb965d4b7f614522170af6a7e450be0333792ccd2 (patch)
tree31f8ae8e50239905627687e454bb3c1f2cac30f1 /drivers/hwmon/lm87.c
parenthwmon: (lm78) Add individual alarm files (diff)
downloadlinux-b965d4b7f614522170af6a7e450be0333792ccd2.tar.xz
linux-b965d4b7f614522170af6a7e450be0333792ccd2.zip
hwmon: (lm87) Fix a division by zero
Missing parentheses in the definition of FAN_FROM_REG cause a division by zero for a specific register value. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Hans de Goede <j.w.r.degoede@hhs.nl> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon/lm87.c')
-rw-r--r--drivers/hwmon/lm87.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c
index e60076e8b597..ef8a9b251cd8 100644
--- a/drivers/hwmon/lm87.c
+++ b/drivers/hwmon/lm87.c
@@ -129,7 +129,7 @@ static u8 LM87_REG_TEMP_LOW[3] = { 0x3A, 0x38, 0x2C };
(((val) < 0 ? (val)-500 : (val)+500) / 1000))
#define FAN_FROM_REG(reg,div) ((reg) == 255 || (reg) == 0 ? 0 : \
- 1350000 + (reg)*(div) / 2) / ((reg)*(div))
+ (1350000 + (reg)*(div) / 2) / ((reg)*(div)))
#define FAN_TO_REG(val,div) ((val)*(div) * 255 <= 1350000 ? 255 : \
(1350000 + (val)*(div) / 2) / ((val)*(div)))