Skip to content

Commit

Permalink
hwmon: (f75375s) Fix value range for PWM modes
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Guenter Roeck committed Jan 5, 2012
1 parent 740f6be commit 3310600
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hwmon/f75375s.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3310600

Please sign in to comment.