Skip to contentSkip to conversation

hwmon: (smm665): Return error from i2c_smbus_read_word_swapped

PATCH In review Guenter Roeck 2 participants 2 messages Feb 12, 2014 Hardware monitoring

lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 2/2 hwmon: (smm665): Return error from i2c_smbus_read_word_swapped

There is no reason to replace one error code with another, and returning -1 as error code is wrong anyway.

Smatch log:
drivers/hwmon/smm665.c:225 smm665_read_adc() info: why not propagate 'rv' from i2c_smbus_read_word_swapped() instead of (-1)?

---
 drivers/hwmon/smm665.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/smm665.c +1 -1
index d9e1b7d..4ef5802 100644
@@ -222,7 +222,7 @@ static int smm665_read_adc(struct smm665_data *data, int adc)
 	rv = i2c_smbus_read_word_swapped(client, 0);
 	if (rv < 0) {
 		dev_dbg(&client->dev, "Failed to read ADC value: error %d", rv);
-		return -1;
+		return rv;
 	}
 	/*
 	 * Validate/verify readback adc channel (in bit 11..14).
Signature · 7 lines
1.7.9.7


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Reviewed-by on v1 2/2
#1 lore raw
Quoted 17 lines · Guenter Roeck

There is no reason to replace one error code with another, and returning -1 as error code is wrong anyway.

Smatch log:
drivers/hwmon/smm665.c:225 smm665_read_adc() info: why not propagate 'rv' from i2c_smbus_read_word_swapped() instead of (-1)?

---
 drivers/hwmon/smm665.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/smm665.c +0 -0
index d9e1b7d..4ef5802 100644

drivers/hwmon/smm665.c static int smm665_read_adc(struct smm665_data *data, int adc) · line 228

Quoted 8 lines
drivers/hwmon/smm665.c +1 -1
@@ -222,7 +222,7 @@ static int smm665_read_adc(struct smm665_data *data, int adc)
 	rv = i2c_smbus_read_word_swapped(client, 0);
 	if (rv < 0) {
 		dev_dbg(&client->dev, "Failed to read ADC value: error %d", rv);
-		return -1;
+		return rv;
 	}
 	/*
 	 * Validate/verify readback adc channel (in bit 11..14).

Good catch.

Signature · 7 lines
Jean Delvare
Suse L3 Support

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