summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/jc42.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/jc42.c')
-rw-r--r--drivers/hwmon/jc42.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c
index f8e3bbbf019c..a46cb65cacb5 100644
--- a/drivers/hwmon/jc42.c
+++ b/drivers/hwmon/jc42.c
@@ -312,7 +312,9 @@ static ssize_t set_temp_crit_hyst(struct device *dev,
if (kstrtoul(buf, 10, &val) < 0)
return -EINVAL;
+ val = clamp_val(val, 0, JC42_TEMP_MAX);
diff = jc42_temp_from_reg(data->temp[t_crit]) - val;
+
hyst = 0;
if (diff > 0) {
if (diff < 2250)