aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/windfarm_smu_sensors.c
diff options
context:
space:
mode:
authorNathan Chancellor <nathan@kernel.org>2023-02-15 10:12:12 -0700
committerMichael Ellerman <mpe@ellerman.id.au>2023-02-16 10:16:31 +1100
commit748ea32d2dbd813d3bd958117bde5191182f909a (patch)
tree6bedd59a809ee51fd49552978507c5ebec7cac6d /drivers/macintosh/windfarm_smu_sensors.c
parentb0ae5b6f3c298a005b73556740526c0e24a5633c (diff)
downloadlinux-748ea32d2dbd813d3bd958117bde5191182f909a.tar.gz
macintosh: windfarm: Use unsigned type for 1-bit bitfields
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
Diffstat (limited to 'drivers/macintosh/windfarm_smu_sensors.c')
-rw-r--r--drivers/macintosh/windfarm_smu_sensors.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/macintosh/windfarm_smu_sensors.c b/drivers/macintosh/windfarm_smu_sensors.c
index 00c6fe25fcba0c..2bdb73b34d291b 100644
--- a/drivers/macintosh/windfarm_smu_sensors.c
+++ b/drivers/macintosh/windfarm_smu_sensors.c
@@ -274,8 +274,8 @@ struct smu_cpu_power_sensor {
struct list_head link;
struct wf_sensor *volts;
struct wf_sensor *amps;
- int fake_volts : 1;
- int quadratic : 1;
+ unsigned int fake_volts : 1;
+ unsigned int quadratic : 1;
struct wf_sensor sens;
};
#define to_smu_cpu_power(c) container_of(c, struct smu_cpu_power_sensor, sens)