Re: drivers/hwmon/jc42.c:477 jc42_readable_reg() warn: always true condition '(reg >= 0) => (0-u32max >= 0)'

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

 



Hi Guenter et al.,

On Thu, Dec 22, 2022 at 3:36 PM kernel test robot <lkp@xxxxxxxxx> 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



[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