Commit 90205c6cbb8fd9880bf798903a99f5b8903455e2

Authored by Jean Delvare
Committed by Mark M. Hoffman
1 parent 3faa1ffb4f

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 <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>

Showing 1 changed file with 2 additions and 0 deletions Side-by-side Diff

drivers/hwmon/smsc47b397.c
... ... @@ -174,6 +174,8 @@
174 174 REG: count of 90kHz pulses / revolution */
175 175 static int fan_from_reg(u16 reg)
176 176 {
  177 + if (reg == 0 || reg == 0xffff)
  178 + return 0;
177 179 return 90000 * 60 / reg;
178 180 }
179 181