diff options
author | Guenter Roeck <linux@roeck-us.net> | 2014-02-15 20:59:05 -0500 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2014-03-03 11:01:04 -0500 |
commit | c5a706697f79b2aa5a2000f8024602320e37658f (patch) | |
tree | d74c291db9ca77f09888b8ab4b69f691f14d2319 /drivers/hwmon/max1668.c | |
parent | b4c9c1a7987ef07d8345bf9d19f36d97423b6b25 (diff) |
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.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Diffstat (limited to 'drivers/hwmon/max1668.c')
-rw-r--r-- | drivers/hwmon/max1668.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/hwmon/max1668.c b/drivers/hwmon/max1668.c index 029b65e6c589..bbbe340332b9 100644 --- a/drivers/hwmon/max1668.c +++ b/drivers/hwmon/max1668.c | |||
@@ -216,10 +216,11 @@ static ssize_t set_temp_max(struct device *dev, | |||
216 | 216 | ||
217 | mutex_lock(&data->update_lock); | 217 | mutex_lock(&data->update_lock); |
218 | data->temp_max[index] = clamp_val(temp/1000, -128, 127); | 218 | data->temp_max[index] = clamp_val(temp/1000, -128, 127); |
219 | if (i2c_smbus_write_byte_data(client, | 219 | ret = i2c_smbus_write_byte_data(client, |
220 | MAX1668_REG_LIMH_WR(index), | 220 | MAX1668_REG_LIMH_WR(index), |
221 | data->temp_max[index])) | 221 | data->temp_max[index]); |
222 | count = -EIO; | 222 | if (ret < 0) |
223 | count = ret; | ||
223 | mutex_unlock(&data->update_lock); | 224 | mutex_unlock(&data->update_lock); |
224 | 225 | ||
225 | return count; | 226 | return count; |
@@ -241,10 +242,11 @@ static ssize_t set_temp_min(struct device *dev, | |||
241 | 242 | ||
242 | mutex_lock(&data->update_lock); | 243 | mutex_lock(&data->update_lock); |
243 | data->temp_min[index] = clamp_val(temp/1000, -128, 127); | 244 | data->temp_min[index] = clamp_val(temp/1000, -128, 127); |
244 | if (i2c_smbus_write_byte_data(client, | 245 | ret = i2c_smbus_write_byte_data(client, |
245 | MAX1668_REG_LIML_WR(index), | 246 | MAX1668_REG_LIML_WR(index), |
246 | data->temp_min[index])) | 247 | data->temp_min[index]); |
247 | count = -EIO; | 248 | if (ret < 0) |
249 | count = ret; | ||
248 | mutex_unlock(&data->update_lock); | 250 | mutex_unlock(&data->update_lock); |
249 | 251 | ||
250 | return count; | 252 | return count; |