summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2018-01-17 07:04:02 +0300
committerJoel Stanley <joel@jms.id.au>2018-01-17 23:55:08 +0300
commit3def25ca7f3641339439668ac929f9e6d7ffe3ff (patch)
treebdecf6bfd3760cea917bce40744a452a31584146
parent649c3383044249d278a52e907021955c33d62de4 (diff)
downloadlinux-3def25ca7f3641339439668ac929f9e6d7ffe3ff.tar.xz
hwmon: (w83773g) Fix fault detection and reporting
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. OpenBMC-Staging-Count: 1 Fixes: 86a10c802362 ("hwmon: Add W83773G driver") Cc: Lei YU <mine260309@gmail.com> Reviewed-by: Lei YU <mine260309@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Joel Stanley <joel@jms.id.au>
-rw-r--r--drivers/hwmon/w83773g.c2
1 files changed, 1 insertions, 1 deletions
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;
}