diff mbox series

hwmon: (adm1177) Fix adm1177_write_alert_thr()

Message ID 20200114055125.ro5slro6zewr56tx@kili.mountain (mailing list archive)
State Superseded
Headers show
Series hwmon: (adm1177) Fix adm1177_write_alert_thr() | expand

Commit Message

Dan Carpenter Jan. 14, 2020, 5:51 a.m. UTC
There is a reversed condition so the adm1177_write_alert_thr() function
doesn't update "st->alert_threshold_ua".

Fixes: 829091f9c56c ("hwmon: (adm1177) Add ADM1177 Hot Swap Controller and Digital Power Monitor driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/hwmon/adm1177.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Guenter Roeck Jan. 14, 2020, 2:12 p.m. UTC | #1
On Tue, Jan 14, 2020 at 08:51:25AM +0300, Dan Carpenter wrote:
> There is a reversed condition so the adm1177_write_alert_thr() function
> doesn't update "st->alert_threshold_ua".
> 
> Fixes: 829091f9c56c ("hwmon: (adm1177) Add ADM1177 Hot Swap Controller and Digital Power Monitor driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

The fix was folded into v4 of the series, so I took that.

Thanks for reporting!

Guenter

> ---
>  drivers/hwmon/adm1177.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/adm1177.c b/drivers/hwmon/adm1177.c
> index 1f2ff7a29306..d314223a404a 100644
> --- a/drivers/hwmon/adm1177.c
> +++ b/drivers/hwmon/adm1177.c
> @@ -63,7 +63,7 @@ static int adm1177_write_alert_thr(struct adm1177_state *st,
>  
>  	ret = i2c_smbus_write_byte_data(st->client, ADM1177_REG_ALERT_TH,
>  					val);
> -	if (!ret)
> +	if (ret)
>  		return ret;
>  
>  	st->alert_threshold_ua = alert_threshold_ua;
diff mbox series

Patch

diff --git a/drivers/hwmon/adm1177.c b/drivers/hwmon/adm1177.c
index 1f2ff7a29306..d314223a404a 100644
--- a/drivers/hwmon/adm1177.c
+++ b/drivers/hwmon/adm1177.c
@@ -63,7 +63,7 @@  static int adm1177_write_alert_thr(struct adm1177_state *st,
 
 	ret = i2c_smbus_write_byte_data(st->client, ADM1177_REG_ALERT_TH,
 					val);
-	if (!ret)
+	if (ret)
 		return ret;
 
 	st->alert_threshold_ua = alert_threshold_ua;