[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f699bbba-69e6-2e62-98ed-0482f4c9a900@infradead.org>
Date: Wed, 2 Nov 2022 19:59:06 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: wangkailong@...i.cn, jdelvare@...e.com, linux@...ck-us.net
Cc: linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hwmon: (amc6821) Fix unsigned expression compared with
zero
On 11/2/22 19:27, wangkailong@...i.cn wrote:
> Fix the following coccicheck warning:
>
> drivers/hwmon/amc6821.c:215: WARNING: Unsigned expression compared
> with zero: reg > 0
> drivers/hwmon/amc6821.c:228: WARNING: Unsigned expression compared
> with zero: reg > 0
>
> Signed-off-by: KaiLong Wang <wangkailong@...i.cn>
Hm. IDGI. What's wrong with comparing an unsigned value to > 0?
I mean, it could be == 0 or > 0.
Please explain.
> ---
> drivers/hwmon/amc6821.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c
> index 3bfd12ff4b3c..1f5382f8d52b 100644
> --- a/drivers/hwmon/amc6821.c
> +++ b/drivers/hwmon/amc6821.c
> @@ -166,7 +166,7 @@ static struct amc6821_data *amc6821_update_device(struct device *dev)
> struct amc6821_data *data = dev_get_drvdata(dev);
> struct i2c_client *client = data->client;
> int timeout = HZ;
> - u8 reg;
> + int reg;
> int i;
>
> mutex_lock(&data->update_lock);
--
~Randy
Powered by blists - more mailing lists