aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/lm85.c5
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)
199{ 199{
200 int i; 200 int i;
201 201
202 if (freq >= lm85_freq_map[7]) 202 /* Find the closest match */
203 return 7;
204 for (i = 0; i < 7; ++i) 203 for (i = 0; i < 7; ++i)
205 if (freq <= lm85_freq_map[i]) 204 if (freq <= (lm85_freq_map[i] + lm85_freq_map[i + 1]) / 2)
206 break; 205 break;
207 return i; 206 return i;
208} 207}