All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH 2/3] hwmon: (max1668) Don't hide return value from i2c_smbus_write_byte_data
@ 2014-02-16  2:08 Guenter Roeck
  2014-02-18 21:44 ` Jean Delvare
  0 siblings, 1 reply; 2+ messages in thread
From: Guenter Roeck @ 2014-02-16  2:08 UTC (permalink / raw)
  To: lm-sensors

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>
---
 drivers/hwmon/max1668.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/hwmon/max1668.c b/drivers/hwmon/max1668.c
index 029b65e..bbbe340 100644
--- a/drivers/hwmon/max1668.c
+++ b/drivers/hwmon/max1668.c
@@ -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;
-- 
1.7.9.7


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [lm-sensors] [PATCH 2/3] hwmon: (max1668) Don't hide return value from i2c_smbus_write_byte_data
  2014-02-16  2:08 [lm-sensors] [PATCH 2/3] hwmon: (max1668) Don't hide return value from i2c_smbus_write_byte_data Guenter Roeck
@ 2014-02-18 21:44 ` Jean Delvare
  0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2014-02-18 21:44 UTC (permalink / raw)
  To: lm-sensors

On Sat, 15 Feb 2014 18:08:00 -0800, Guenter Roeck wrote:
> 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>
> ---
>  drivers/hwmon/max1668.c |   14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/hwmon/max1668.c b/drivers/hwmon/max1668.c
> index 029b65e..bbbe340 100644
> --- a/drivers/hwmon/max1668.c
> +++ b/drivers/hwmon/max1668.c
> @@ -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;

Good change.

Reviewed-by: Jean Delvare <jdelvare@suse.de>

-- 
Jean Delvare
Suse L3 Support

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-18 21:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-16  2:08 [lm-sensors] [PATCH 2/3] hwmon: (max1668) Don't hide return value from i2c_smbus_write_byte_data Guenter Roeck
2014-02-18 21:44 ` Jean Delvare

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.