hwmon: (max1668) Don't hide return value from i2c_smbus_write_byte_data
authorGuenter Roeck <linux@roeck-us.net>
Sun, 16 Feb 2014 01:59:05 +0000 (17:59 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 3 Mar 2014 16:01:04 +0000 (08:01 -0800)
i2c_smbus_write_byte_data returns a valid error code.
Return it to the user instead of replacing it with -EIO.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
drivers/hwmon/max1668.c

index 029b65e6c58914d36061914e35738bda0c1e385c..bbbe340332b9524f949118171c023ece97d93a26 100644 (file)
@@ -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;