[lm-sensors] [PATCH 3/4] hwmon: (f75375s) Fix value range for PWM modes

Björn Gerhart oss at extracloud.de
Sat Dec 10 20:50:21 CET 2011


2011/12/8 Guenter Roeck <guenter.roeck at ericsson.com>:
> 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 at iki.fi>
> Signed-off-by: Guenter Roeck <guenter.roeck at ericsson.com>
Reviewed-by: Bjoern Gerhart <oss at extracloud.de>
> ---
> drivers/hwmon/f75375s.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
> 
> 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);
> -- 
> 1.7.3.1
> 





More information about the lm-sensors mailing list