hwmon: (f75375s) Fix value range for PWM modes
authorGuenter Roeck <guenter.roeck@ericsson.com>
Thu, 8 Dec 2011 18:01:25 +0000 (10:01 -0800)
committerGuenter Roeck <guenter.roeck@ericsson.com>
Thu, 5 Jan 2012 16:19:30 +0000 (08:19 -0800)
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 <riku.voipio@iki.fi>
Reviewed-by: Bjoern Gerhart <oss@extracloud.de>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
drivers/hwmon/f75375s.c

index 316c29a0b3183130a00ac17213ace08961623c1f..777a665164f992d89500ef9cd2c91fb05d19d575 100644 (file)
@@ -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);