diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hwmon/sht15.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c index 864a371f6eb9..bf41d4e6e5ac 100644 --- a/drivers/hwmon/sht15.c +++ b/drivers/hwmon/sht15.c | |||
@@ -302,13 +302,13 @@ error_ret: | |||
302 | **/ | 302 | **/ |
303 | static inline int sht15_calc_temp(struct sht15_data *data) | 303 | static inline int sht15_calc_temp(struct sht15_data *data) |
304 | { | 304 | { |
305 | int d1 = 0; | 305 | int d1 = temppoints[0].d1; |
306 | int i; | 306 | int i; |
307 | 307 | ||
308 | for (i = 1; i < ARRAY_SIZE(temppoints); i++) | 308 | for (i = ARRAY_SIZE(temppoints) - 1; i > 0; i--) |
309 | /* Find pointer to interpolate */ | 309 | /* Find pointer to interpolate */ |
310 | if (data->supply_uV > temppoints[i - 1].vdd) { | 310 | if (data->supply_uV > temppoints[i - 1].vdd) { |
311 | d1 = (data->supply_uV/1000 - temppoints[i - 1].vdd) | 311 | d1 = (data->supply_uV - temppoints[i - 1].vdd) |
312 | * (temppoints[i].d1 - temppoints[i - 1].d1) | 312 | * (temppoints[i].d1 - temppoints[i - 1].d1) |
313 | / (temppoints[i].vdd - temppoints[i - 1].vdd) | 313 | / (temppoints[i].vdd - temppoints[i - 1].vdd) |
314 | + temppoints[i - 1].d1; | 314 | + temppoints[i - 1].d1; |