Re: [PATCH] hwmon: (w83773g) Fix fault detection and reporting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reviewed-by: Lei YU <mine260309@xxxxxxxxx>

Thanks for catching this.


On Mon, Dec 4, 2017 at 10:13 AM, Guenter Roeck <linux@xxxxxxxxxxxx> 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@xxxxxxxxx>
> Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> ---
>  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
>
--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux