From: Guenter Roeck Date: Thu, 8 Dec 2011 18:01:25 +0000 (-0800) Subject: hwmon: (f75375s) Fix value range for PWM modes X-Git-Tag: v3.3-rc1~162^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3310600aa7bc11ead9b0324b972d13fb0e91bcaf;p=profile%2Fivi%2Fkernel-x86-ivi.git 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 --- diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c index 316c29a..777a665 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);