thermal: underflow bug in imx_set_trip_temp()
We recently changed this from unsigned long to int so it introduced an
underflow bug.
Fixes: 17e8351a7739 ('thermal: consistently use int for temperatures')
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Eduardo Valentin <[email protected]>
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index acd1c78..c8fe3ca 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -288,7 +288,7 @@
if (trip == IMX_TRIP_CRITICAL)
return -EPERM;
- if (temp > IMX_TEMP_PASSIVE)
+ if (temp < 0 || temp > IMX_TEMP_PASSIVE)
return -EINVAL;
data->temp_passive = temp;