From: Dan Carpenter Date: Tue, 24 Oct 2017 09:47:42 +0000 (+0300) Subject: hwmon: (max6621) Inverted if condition in max6621_read() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=5813da157f7dbe03d268c8d0dd9425d0e3944910;p=linux.git 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 Acked-by: Vadim Pasternak Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/max6621.c b/drivers/hwmon/max6621.c index 22079ec29660e..35555f0eefb96 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; }