diff options
-rw-r--r-- | drivers/hwmon/max6697.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/hwmon/max6697.c b/drivers/hwmon/max6697.c index b28b7b9448aa..05085646ba99 100644 --- a/drivers/hwmon/max6697.c +++ b/drivers/hwmon/max6697.c @@ -311,6 +311,7 @@ static ssize_t temp_store(struct device *dev, return ret; mutex_lock(&data->update_lock); + temp = clamp_val(temp, -1000000, 1000000); /* prevent underflow */ temp = DIV_ROUND_CLOSEST(temp, 1000) + data->temp_offset; temp = clamp_val(temp, 0, data->type == max6581 ? 255 : 127); data->temp[nr][index] = temp; |