* [PATCH] hwmon: (w83773g) Fix fault detection and reporting
@ 2017-12-04 2:13 Guenter Roeck
2017-12-04 4:23 ` Lei YU
0 siblings, 1 reply; 2+ messages in thread
From: Guenter Roeck @ 2017-12-04 2:13 UTC (permalink / raw)
To: Hardware Monitoring; +Cc: Jean Delvare, Guenter Roeck, Lei YU
Smatch reports:
drivers/hwmon/w83773g.c:105
get_fault() warn: shift has higher precedence than mask
Code analysis shows that the code is indeed wrong.
Fix it, and while we are at it, drop unnecessary typecast.
Fixes: 86a10c802362 ("hwmon: Add W83773G driver")
Cc: Lei YU <mine260309@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/hwmon/w83773g.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwmon/w83773g.c b/drivers/hwmon/w83773g.c
index 0b97c285b049..e858093ac806 100644
--- a/drivers/hwmon/w83773g.c
+++ b/drivers/hwmon/w83773g.c
@@ -102,7 +102,7 @@ static int get_fault(struct regmap *regmap, int index, long *val)
if (ret < 0)
return ret;
- *val = (u8)regval & 0x04 >> 2;
+ *val = (regval & 0x04) >> 2;
return 0;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hwmon: (w83773g) Fix fault detection and reporting
2017-12-04 2:13 [PATCH] hwmon: (w83773g) Fix fault detection and reporting Guenter Roeck
@ 2017-12-04 4:23 ` Lei YU
0 siblings, 0 replies; 2+ messages in thread
From: Lei YU @ 2017-12-04 4:23 UTC (permalink / raw)
To: Guenter Roeck; +Cc: Hardware Monitoring, Jean Delvare
Reviewed-by: Lei YU <mine260309@gmail.com>
Thanks for catching this.
On Mon, Dec 4, 2017 at 10:13 AM, Guenter Roeck <linux@roeck-us.net> wrote:
> Smatch reports:
>
> drivers/hwmon/w83773g.c:105
> get_fault() warn: shift has higher precedence than mask
>
> Code analysis shows that the code is indeed wrong.
> Fix it, and while we are at it, drop unnecessary typecast.
>
> Fixes: 86a10c802362 ("hwmon: Add W83773G driver")
> Cc: Lei YU <mine260309@gmail.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/hwmon/w83773g.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/w83773g.c b/drivers/hwmon/w83773g.c
> index 0b97c285b049..e858093ac806 100644
> --- a/drivers/hwmon/w83773g.c
> +++ b/drivers/hwmon/w83773g.c
> @@ -102,7 +102,7 @@ static int get_fault(struct regmap *regmap, int index, long *val)
> if (ret < 0)
> return ret;
>
> - *val = (u8)regval & 0x04 >> 2;
> + *val = (regval & 0x04) >> 2;
> return 0;
> }
>
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-04 4:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-04 2:13 [PATCH] hwmon: (w83773g) Fix fault detection and reporting Guenter Roeck
2017-12-04 4:23 ` Lei YU
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).