diff options
-rw-r--r-- | drivers/hwmon/emc1403.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/hwmon/emc1403.c b/drivers/hwmon/emc1403.c index 46220b13115..c62bc044a66 100644 --- a/drivers/hwmon/emc1403.c +++ b/drivers/hwmon/emc1403.c @@ -147,12 +147,7 @@ static ssize_t store_hyst(struct device *dev, goto fail; hyst = limit * 1000 - val; - hyst = DIV_ROUND_CLOSEST(hyst, 1000); - if (hyst < 0 || hyst > 255) { - retval = -ERANGE; - goto fail; - } - + hyst = clamp_val(DIV_ROUND_CLOSEST(hyst, 1000), 0, 255); retval = regmap_write(regmap, 0x21, hyst); if (retval == 0) retval = count; |