diff options
Diffstat (limited to 'drivers/hwmon/gpio-fan.c')
| -rw-r--r-- | drivers/hwmon/gpio-fan.c | 3 | 
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;  } | 
