diff options
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/lm85.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 6b676df3547b..c323c2b89808 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c @@ -199,10 +199,9 @@ static int FREQ_TO_REG(int freq) { int i; - if (freq >= lm85_freq_map[7]) - return 7; + /* Find the closest match */ for (i = 0; i < 7; ++i) - if (freq <= lm85_freq_map[i]) + if (freq <= (lm85_freq_map[i] + lm85_freq_map[i + 1]) / 2) break; return i; } |