linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lei YU <mine260309@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Hardware Monitoring <linux-hwmon@vger.kernel.org>,
	Jean Delvare <jdelvare@suse.com>
Subject: Re: [PATCH] hwmon: (w83773g) Fix fault detection and reporting
Date: Mon, 4 Dec 2017 12:23:46 +0800	[thread overview]
Message-ID: <CAARXrtmg-DYb7W_yZeVqMJz3P9LSPKoWSMOUTcmnHDsm7ZoaxA@mail.gmail.com> (raw)
In-Reply-To: <1512353636-13985-1-git-send-email-linux@roeck-us.net>

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
>

      reply	other threads:[~2017-12-04  4:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04  2:13 [PATCH] hwmon: (w83773g) Fix fault detection and reporting Guenter Roeck
2017-12-04  4:23 ` Lei YU [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAARXrtmg-DYb7W_yZeVqMJz3P9LSPKoWSMOUTcmnHDsm7ZoaxA@mail.gmail.com \
    --to=mine260309@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).