]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
hwmon/lm87: Fix a division by zero
authorJean Delvare <khali@linux-fr.org>
Mon, 15 Oct 2007 11:49:50 +0000 (13:49 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 2 Nov 2007 15:44:14 +0000 (08:44 -0700)
Already in Linus' tree:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=b965d4b7f614522170af6a7e450be0333792ccd2

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/hwmon/lm87.c

index 988ae1c4aada69ebb2f9315258ac1b4ee878f65b..8dbb2be1e81c73797750c8421ebe42591d00e175 100644 (file)
@@ -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)))