Skip to contentSkip to conversation

hwmon: (f75375s) Fix value range for PWM

PATCH In review Guenter Roeck 2 participants 3 messages Dec 8, 2011 – Dec 10, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/4 hwmon: (f75375s) Fix value range for PWM

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.

---
 drivers/hwmon/f75375s.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/f75375s.c +1 -1
index 316c29a..777a665 100644
@@ -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);
Signature · 7 lines
1.7.3.1


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw

PATCH 3/4 hwmon: (f75375s) Fix value range for PWM

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.

---
 drivers/hwmon/f75375s.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/f75375s.c +1 -1
index 316c29a..777a665 100644
@@ -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);
Signature · 7 lines
1.7.3.1


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Reviewed-by on v1 3/4
#2 lore raw

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

In reply to Guenter Roeck

2011/12/8 Guenter Roeck <[email protected]>:

Quoted 6 lines

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.

Quoted 20 lines

---
drivers/hwmon/f75375s.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/f75375s.c +1 -1
index 316c29a..777a665 100644
@@ -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);
Signature · 1 line
1.7.3.1

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors