From: Jean Delvare Date: Sat, 23 Jun 2007 12:58:22 +0000 (+0200) Subject: hwmon/smsc47b397: Don't report missing fans as spinning at 82 RPM X-Git-Tag: v2.6.23-rc1~258^2~15 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90205c6cbb8fd9880bf798903a99f5b8903455e2;p=linux-2.6 hwmon/smsc47b397: Don't report missing fans as spinning at 82 RPM Also protects ourselves against a possible division by zero. Signed-off-by: Jean Delvare Signed-off-by: Mark M. Hoffman --- diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c index 3b65b0e61c..45266b30ce 100644 --- a/drivers/hwmon/smsc47b397.c +++ b/drivers/hwmon/smsc47b397.c @@ -174,6 +174,8 @@ static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp, NULL, 3); REG: count of 90kHz pulses / revolution */ static int fan_from_reg(u16 reg) { + if (reg == 0 || reg == 0xffff) + return 0; return 90000 * 60 / reg; }