Skip to content
Commit dd7fe5d9 authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Alexandre Belloni
Browse files

rtc: max31335: Fix comparison in max31335_volatile_reg()

Clang warns (or errors with CONFIG_WERROR=y):

    drivers/rtc/rtc-max31335.c:211:36: error: use of logical '||' with constant operand [-Werror,-Wconstant-logical-operand]
      211 |         if (reg == MAX31335_TEMP_DATA_MSB || MAX31335_TEMP_DATA_LSB)
          |                                           ^  ~~~~~~~~~~~~~~~~~~~~~~
    drivers/rtc/rtc-max31335.c:211:36: note: use '|' for a bitwise operation
      211 |         if (reg == MAX31335_TEMP_DATA_MSB || MAX31335_TEMP_DATA_LSB)
          |                                           ^~
          |                                           |
    1 error generated.

This clearly should be a comparison against reg. Fix the comparison so
that max31335_volatile_reg() does not always return true.

Closes: https://github.com/ClangBuiltLinux/linux/issues/1980


Fixes: dedaf03b ("rtc: max31335: add driver support")
Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20240117-rtc-max3133-fix-comparison-v1-1-91e98b29d564@kernel.org


Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent b7d450d9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment