summaryrefslogtreecommitdiff
path: root/drivers/hwmon/gpio-fan.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa@kernel.org>2022-09-16 22:42:18 +0300
committerWolfram Sang <wsa@kernel.org>2022-09-16 22:42:18 +0300
commitd819524d3144f4703f45f473fdc85ad7579ae94c (patch)
tree9bcb29b9b1a24ecf5a1a367c1af7d9be138ba041 /drivers/hwmon/gpio-fan.c
parent859d64685d6c868db62b86064769b053db8bf834 (diff)
parent80e78fcce86de0288793a0ef0f6acf37656ee4cf (diff)
downloadlinux-d819524d3144f4703f45f473fdc85ad7579ae94c.tar.xz
Merge tag 'v6.0-rc5' into i2c/for-mergewindow
Linux 6.0-rc5
Diffstat (limited to 'drivers/hwmon/gpio-fan.c')
-rw-r--r--drivers/hwmon/gpio-fan.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
index befe989ca7b9..fbf3f5a4ecb6 100644
--- a/drivers/hwmon/gpio-fan.c
+++ b/drivers/hwmon/gpio-fan.c
@@ -391,6 +391,9 @@ static int gpio_fan_set_cur_state(struct thermal_cooling_device *cdev,
if (!fan_data)
return -EINVAL;
+ if (state >= fan_data->num_speed)
+ return -EINVAL;
+
set_fan_speed(fan_data, state);
return 0;
}