Skip to contentSkip to conversation

hwmon: (max1668) Don't hide return value from i2c_smbus_write_byte_data

PATCH In review Guenter Roeck 2 participants 2 messages Feb 16, 2014 – Feb 18, 2014 Hardware monitoring

lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 2/3 hwmon: (max1668) Don't hide return value from i2c_smbus_write_byte_data

i2c_smbus_write_byte_data returns a valid error code. Return it to the user instead of replacing it with -EIO.

---
 drivers/hwmon/max1668.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/hwmon/max1668.c +8 -6
index 029b65e..bbbe340 100644
@@ -216,10 +216,11 @@ static ssize_t set_temp_max(struct device *dev,
 
 	mutex_lock(&data->update_lock);
 	data->temp_max[index] = clamp_val(temp/1000, -128, 127);
-	if (i2c_smbus_write_byte_data(client,
+	ret = i2c_smbus_write_byte_data(client,
 					MAX1668_REG_LIMH_WR(index),
-					data->temp_max[index]))
-		count = -EIO;
+					data->temp_max[index]);
+	if (ret < 0)
+		count = ret;
 	mutex_unlock(&data->update_lock);
 
 	return count;
@@ -241,10 +242,11 @@ static ssize_t set_temp_min(struct device *dev,
 
 	mutex_lock(&data->update_lock);
 	data->temp_min[index] = clamp_val(temp/1000, -128, 127);
-	if (i2c_smbus_write_byte_data(client,
+	ret = i2c_smbus_write_byte_data(client,
 					MAX1668_REG_LIML_WR(index),
-					data->temp_min[index]))
-		count = -EIO;
+					data->temp_min[index]);
+	if (ret < 0)
+		count = ret;
 	mutex_unlock(&data->update_lock);
 
 	return count;
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/3
#1 lore raw
Quoted 32 lines · Guenter Roeck

i2c_smbus_write_byte_data returns a valid error code. Return it to the user instead of replacing it with -EIO.

---
 drivers/hwmon/max1668.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/hwmon/max1668.c +4 -4
index 029b65e..bbbe340 100644
@@ -216,10 +216,11 @@ static ssize_t set_temp_max(struct device *dev,
 
 	mutex_lock(&data->update_lock);
 	data->temp_max[index] = clamp_val(temp/1000, -128, 127);
-	if (i2c_smbus_write_byte_data(client,
+	ret = i2c_smbus_write_byte_data(client,
 					MAX1668_REG_LIMH_WR(index),
-					data->temp_max[index]))
-		count = -EIO;
+					data->temp_max[index]);
+	if (ret < 0)
+		count = ret;
 	mutex_unlock(&data->update_lock);
 
 	return count;
@@ -241,10 +242,11 @@ static ssize_t set_temp_min(struct device *dev,
 
 	mutex_lock(&data->update_lock);
 	data->temp_min[index] = clamp_val(temp/1000, -128, 127);
-	if (i2c_smbus_write_byte_data(client,

drivers/hwmon/max1668.c static ssize_t set_temp_min(struct device *dev, · line 252

Quoted 10 lines
drivers/hwmon/max1668.c +4 -2
+	ret = i2c_smbus_write_byte_data(client,
 					MAX1668_REG_LIML_WR(index),
-					data->temp_min[index]))
-		count = -EIO;
+					data->temp_min[index]);
+	if (ret < 0)
+		count = ret;
 	mutex_unlock(&data->update_lock);
 
 	return count;

Good change.

Signature · 7 lines
Jean Delvare
Suse L3 Support

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