Skip to content

Commit

Permalink
hwmon: (emc2103) fix unable to change fan pwm1_enable attribute
Browse files Browse the repository at this point in the history
This patch fixes a bug which does not let FAN mode to be changed from
sysfs(pwm1_enable). i.e pwm1_enable can not be set to 3, it will always
remain at 0.

This is caused because the device driver handles the result of
"read_u8_from_i2c(client, REG_FAN_CONF1, &conf_reg)" incorrectly. The
driver thinks an error has occurred if the (result != 0). This has been
fixed by changing the condition to (result < 0).

Signed-off-by: Vishwas M <vishwas.reddy.vr@gmail.com>
Link: https://lore.kernel.org/r/20200707142747.118414-1-vishwas.reddy.vr@gmail.com
Fixes: 9df7305 ("hwmon: Add driver for SMSC EMC2103 temperature monitor and fan controller")
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  • Loading branch information
Vishwas M authored and Guenter Roeck committed Jul 7, 2020
1 parent f28e360 commit 14b0e83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hwmon/emc2103.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ static ssize_t pwm1_enable_store(struct device *dev,
}

result = read_u8_from_i2c(client, REG_FAN_CONF1, &conf_reg);
if (result) {
if (result < 0) {
count = result;
goto err;
}
Expand Down

0 comments on commit 14b0e83

Please sign in to comment.