* [PATCH] hwmon: (max6621) Inverted if condition in max6621_read()
@ 2017-10-24 9:47 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2017-10-24 9:47 UTC (permalink / raw)
To: Jean Delvare, Vadim Pasternak; +Cc: Guenter Roeck, linux-hwmon, kernel-janitors
We intended to test for failure here but accidentally tested for
success. It means that we don't set "*val" to true and it means that
if i2c_smbus_write_byte() does fail then we return success.
Fixes: e7895864b0d7 ("hwmon: (max6621) Add support for Maxim MAX6621 temperature sensor")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/hwmon/max6621.c b/drivers/hwmon/max6621.c
index 22079ec29660..35555f0eefb9 100644
--- a/drivers/hwmon/max6621.c
+++ b/drivers/hwmon/max6621.c
@@ -296,7 +296,7 @@ max6621_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
if (regval) {
ret = i2c_smbus_write_byte(data->client,
MAX6621_CLEAR_ALERT_REG);
- if (!ret)
+ if (ret)
return ret;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] hwmon: (max6621) Inverted if condition in max6621_read()
@ 2017-10-24 9:47 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2017-10-24 9:47 UTC (permalink / raw)
To: Jean Delvare, Vadim Pasternak; +Cc: Guenter Roeck, linux-hwmon, kernel-janitors
We intended to test for failure here but accidentally tested for
success. It means that we don't set "*val" to true and it means that
if i2c_smbus_write_byte() does fail then we return success.
Fixes: e7895864b0d7 ("hwmon: (max6621) Add support for Maxim MAX6621 temperature sensor")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/hwmon/max6621.c b/drivers/hwmon/max6621.c
index 22079ec29660..35555f0eefb9 100644
--- a/drivers/hwmon/max6621.c
+++ b/drivers/hwmon/max6621.c
@@ -296,7 +296,7 @@ max6621_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
if (regval) {
ret = i2c_smbus_write_byte(data->client,
MAX6621_CLEAR_ALERT_REG);
- if (!ret)
+ if (ret)
return ret;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH] hwmon: (max6621) Inverted if condition in max6621_read()
2017-10-24 9:47 ` Dan Carpenter
(?)
@ 2017-10-24 10:03 ` Vadim Pasternak
-1 siblings, 0 replies; 5+ messages in thread
From: Vadim Pasternak @ 2017-10-24 10:03 UTC (permalink / raw)
To: Dan Carpenter, Jean Delvare; +Cc: Guenter Roeck, linux-hwmon, kernel-janitors
> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Tuesday, October 24, 2017 12:48 PM
> To: Jean Delvare <jdelvare@suse.com>; Vadim Pasternak
> <vadimp@mellanox.com>
> Cc: Guenter Roeck <linux@roeck-us.net>; linux-hwmon@vger.kernel.org;
> kernel-janitors@vger.kernel.org
> Subject: [PATCH] hwmon: (max6621) Inverted if condition in max6621_read()
>
> We intended to test for failure here but accidentally tested for success. It
> means that we don't set "*val" to true and it means that if
> i2c_smbus_write_byte() does fail then we return success.
>
> Fixes: e7895864b0d7 ("hwmon: (max6621) Add support for Maxim MAX6621
> temperature sensor")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Vadim Pasternak <vadimp@mellanox.com>
>
> diff --git a/drivers/hwmon/max6621.c b/drivers/hwmon/max6621.c index
> 22079ec29660..35555f0eefb9 100644
> --- a/drivers/hwmon/max6621.c
> +++ b/drivers/hwmon/max6621.c
> @@ -296,7 +296,7 @@ max6621_read(struct device *dev, enum
> hwmon_sensor_types type, u32 attr,
> if (regval) {
> ret = i2c_smbus_write_byte(data->client,
>
> MAX6621_CLEAR_ALERT_REG);
> - if (!ret)
> + if (ret)
> return ret;
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hwmon: (max6621) Inverted if condition in max6621_read()
2017-10-24 9:47 ` Dan Carpenter
@ 2017-10-24 13:33 ` Guenter Roeck
-1 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2017-10-24 13:33 UTC (permalink / raw)
To: Dan Carpenter, Jean Delvare, Vadim Pasternak; +Cc: linux-hwmon, kernel-janitors
On 10/24/2017 02:47 AM, Dan Carpenter wrote:
> We intended to test for failure here but accidentally tested for
> success. It means that we don't set "*val" to true and it means that
> if i2c_smbus_write_byte() does fail then we return success.
>
> Fixes: e7895864b0d7 ("hwmon: (max6621) Add support for Maxim MAX6621 temperature sensor")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied to hwmon-next.
Thanks,
Guenter
>
> diff --git a/drivers/hwmon/max6621.c b/drivers/hwmon/max6621.c
> index 22079ec29660..35555f0eefb9 100644
> --- a/drivers/hwmon/max6621.c
> +++ b/drivers/hwmon/max6621.c
> @@ -296,7 +296,7 @@ max6621_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
> if (regval) {
> ret = i2c_smbus_write_byte(data->client,
> MAX6621_CLEAR_ALERT_REG);
> - if (!ret)
> + if (ret)
> return ret;
> }
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hwmon: (max6621) Inverted if condition in max6621_read()
@ 2017-10-24 13:33 ` Guenter Roeck
0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2017-10-24 13:33 UTC (permalink / raw)
To: Dan Carpenter, Jean Delvare, Vadim Pasternak; +Cc: linux-hwmon, kernel-janitors
On 10/24/2017 02:47 AM, Dan Carpenter wrote:
> We intended to test for failure here but accidentally tested for
> success. It means that we don't set "*val" to true and it means that
> if i2c_smbus_write_byte() does fail then we return success.
>
> Fixes: e7895864b0d7 ("hwmon: (max6621) Add support for Maxim MAX6621 temperature sensor")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied to hwmon-next.
Thanks,
Guenter
>
> diff --git a/drivers/hwmon/max6621.c b/drivers/hwmon/max6621.c
> index 22079ec29660..35555f0eefb9 100644
> --- a/drivers/hwmon/max6621.c
> +++ b/drivers/hwmon/max6621.c
> @@ -296,7 +296,7 @@ max6621_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
> if (regval) {
> ret = i2c_smbus_write_byte(data->client,
> MAX6621_CLEAR_ALERT_REG);
> - if (!ret)
> + if (ret)
> return ret;
> }
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-24 13:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-24 9:47 [PATCH] hwmon: (max6621) Inverted if condition in max6621_read() Dan Carpenter
2017-10-24 9:47 ` Dan Carpenter
2017-10-24 10:03 ` Vadim Pasternak
2017-10-24 13:33 ` Guenter Roeck
2017-10-24 13:33 ` Guenter Roeck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.