]> git.baikalelectronics.ru Git - kernel.git/commit
macintosh: windfarm: Use unsigned type for 1-bit bitfields
authorNathan Chancellor <nathan@kernel.org>
Wed, 15 Feb 2023 17:12:12 +0000 (10:12 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:50:31 +0000 (08:50 +0100)
commitea2351141d13c162efcffd674461ab51eddfbb90
tree53d4ce951c388c197de5ce383ec622d327f71ed3
parentf402746b9d8a93b010d481d739476b79444546d3
macintosh: windfarm: Use unsigned type for 1-bit bitfields

[ Upstream commit c2408f1b64cab43e572538063b6467dcb0d5a90b ]

Clang warns:

  drivers/macintosh/windfarm_lm75_sensor.c:63:14: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                  lm->inited = 1;
                             ^ ~

  drivers/macintosh/windfarm_smu_sensors.c:356:19: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                  pow->fake_volts = 1;
                                  ^ ~
  drivers/macintosh/windfarm_smu_sensors.c:368:18: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                  pow->quadratic = 1;
                                 ^ ~

There is no bug here since no code checks the actual value of these
fields, just whether or not they are zero (boolean context), but this
can be easily fixed by switching to an unsigned type.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230215-windfarm-wsingle-bit-bitfield-constant-conversion-v1-1-26415072e855@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/macintosh/windfarm_lm75_sensor.c
drivers/macintosh/windfarm_smu_sensors.c