linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: kernel test robot <lkp@intel.com>,
	oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-hwmon@vger.kernel.org
Subject: Re: drivers/hwmon/jc42.c:477 jc42_readable_reg() warn: always true condition '(reg >= 0) => (0-u32max >= 0)'
Date: Thu, 22 Dec 2022 22:20:13 +0100	[thread overview]
Message-ID: <CAFBinCAB0VuoKKm4YHv_zB1d1xN3nP0=-xg9EotiWMJ_vikc2w@mail.gmail.com> (raw)
In-Reply-To: <202212222251.Xacx8c4D-lkp@intel.com>

Hi Guenter et al.,

On Thu, Dec 22, 2022 at 3:36 PM kernel test robot <lkp@intel.com> wrote:
[...]
>    475  static bool jc42_readable_reg(struct device *dev, unsigned int reg)
>    476  {
>  > 477          return (reg >= JC42_REG_CAP && reg <= JC42_REG_DEVICEID) ||
>    478                  reg == JC42_REG_SMBUS;
The bot is right: we can omit "reg >= JC42_REG_CAP" as it's already
covered by the fact that:
- the reg variable is unsigned, which means the lower limit is zero
- reg <= JC42_REG_DEVICEID covers the upper limit

Before I send a patch I'd like to hear if removal of "reg >=
JC42_REG_CAP" makes sense to other people.


Best regards,
Martin

       reply	other threads:[~2022-12-22 21:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <202212222251.Xacx8c4D-lkp@intel.com>
2022-12-22 21:20 ` Martin Blumenstingl [this message]
2022-12-22 23:41   ` drivers/hwmon/jc42.c:477 jc42_readable_reg() warn: always true condition '(reg >= 0) => (0-u32max >= 0)' Guenter Roeck
2022-12-25 14:18     ` Martin Blumenstingl

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='CAFBinCAB0VuoKKm4YHv_zB1d1xN3nP0=-xg9EotiWMJ_vikc2w@mail.gmail.com' \
    --to=martin.blumenstingl@googlemail.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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).