diff mbox

hwmon: (lm90) Add missing assignment

Message ID 1469483441-10702-1-git-send-email-linux@roeck-us.net
State Accepted
Headers show

Commit Message

Guenter Roeck July 25, 2016, 9:50 p.m. UTC
Coverity reports the following error.

>>>     CID 1364474:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "lm90_read_reg" without checking return value (as is done
>>>     elsewhere 28 out of 29 times).
532             lm90_read_reg(client, LM90_REG_R_REMOTE_LOWH);
533             if (val < 0)
534                     return val;

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/hwmon/lm90.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jean Delvare July 26, 2016, 7:21 a.m. UTC | #1
Hi Guenter,

On Mon, 25 Jul 2016 14:50:41 -0700, Guenter Roeck wrote:
> Coverity reports the following error.
> 
> >>>     CID 1364474:  Error handling issues  (CHECKED_RETURN)
> >>>     Calling "lm90_read_reg" without checking return value (as is done
> >>>     elsewhere 28 out of 29 times).
> 532             lm90_read_reg(client, LM90_REG_R_REMOTE_LOWH);
> 533             if (val < 0)
> 534                     return val;
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  drivers/hwmon/lm90.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
> index f51e758ba529..7b3eedf76c62 100644
> --- a/drivers/hwmon/lm90.c
> +++ b/drivers/hwmon/lm90.c
> @@ -529,7 +529,7 @@ static int lm90_update_limits(struct device *dev)
>  		return val;
>  	data->temp_hyst = val;
>  
> -	lm90_read_reg(client, LM90_REG_R_REMOTE_LOWH);
> +	val = lm90_read_reg(client, LM90_REG_R_REMOTE_LOWH);
>  	if (val < 0)
>  		return val;
>  	data->temp11[REMOTE_LOW] = val << 8;

Good catch.

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

Patch

diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index f51e758ba529..7b3eedf76c62 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -529,7 +529,7 @@  static int lm90_update_limits(struct device *dev)
 		return val;
 	data->temp_hyst = val;
 
-	lm90_read_reg(client, LM90_REG_R_REMOTE_LOWH);
+	val = lm90_read_reg(client, LM90_REG_R_REMOTE_LOWH);
 	if (val < 0)
 		return val;
 	data->temp11[REMOTE_LOW] = val << 8;