From: Guenter Roeck Date: Sun, 3 Dec 2017 23:27:56 +0000 (-0800) Subject: hwmon: (w83773g) Fix fault detection and reporting X-Git-Tag: v4.16-rc1~190^2~15 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=571e3f3a8e6582ecce2c7fd5d0a9e2ae74cece02;p=uclinux-h8%2Flinux.git 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. Fixes: 86a10c802362 ("hwmon: Add W83773G driver") Cc: Lei YU Reviewed-by: Lei YU Signed-off-by: Guenter Roeck --- 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; }