From 3310600aa7bc11ead9b0324b972d13fb0e91bcaf Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Thu, 8 Dec 2011 10:01:25 -0800 Subject: [PATCH] hwmon: (f75375s) Fix value range for PWM modes Accepted value range for PWM modes was 0..4, even though only 0..3 is subsequently used. Limit permitted value range to 0..3 to avoid unpredictable behavior. Cc: Riku Voipio Reviewed-by: Bjoern Gerhart Signed-off-by: Guenter Roeck --- drivers/hwmon/f75375s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c index 316c29a0b318..777a665164f9 100644 --- a/drivers/hwmon/f75375s.c +++ b/drivers/hwmon/f75375s.c @@ -309,7 +309,7 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val) struct f75375_data *data = i2c_get_clientdata(client); u8 fanmode; - if (val < 0 || val > 4) + if (val < 0 || val > 3) return -EINVAL; fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); -- 2.20.1