Skip to content

Commit 985b1f5

Browse files
arndbpavelmachek
authored andcommitted
leds: lm355x: avoid enum conversion warning
clang points out that doing arithmetic between diffent enums is usually a mistake: drivers/leds/leds-lm355x.c:167:28: warning: bitwise operation between different enumeration types ('enum lm355x_tx2' and 'enum lm355x_ntc') [-Wenum-enum-conversion] reg_val = pdata->pin_tx2 | pdata->ntc_pin; ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ drivers/leds/leds-lm355x.c:178:28: warning: bitwise operation between different enumeration types ('enum lm355x_tx2' and 'enum lm355x_ntc') [-Wenum-enum-conversion] reg_val = pdata->pin_tx2 | pdata->ntc_pin | pdata->pass_mode; ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ In this driver, it is intentional, so add a cast to hide the false-positive warning. It appears to be the only instance of this warning at the moment. Fixes: b98d13c ("leds: Add new LED driver for lm355x chips") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
1 parent 528c1d7 commit 985b1f5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/leds/leds-lm355x.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,18 +164,19 @@ static int lm355x_chip_init(struct lm355x_chip_data *chip)
164164
/* input and output pins configuration */
165165
switch (chip->type) {
166166
case CHIP_LM3554:
167-
reg_val = pdata->pin_tx2 | pdata->ntc_pin;
167+
reg_val = (u32)pdata->pin_tx2 | (u32)pdata->ntc_pin;
168168
ret = regmap_update_bits(chip->regmap, 0xE0, 0x28, reg_val);
169169
if (ret < 0)
170170
goto out;
171-
reg_val = pdata->pass_mode;
171+
reg_val = (u32)pdata->pass_mode;
172172
ret = regmap_update_bits(chip->regmap, 0xA0, 0x04, reg_val);
173173
if (ret < 0)
174174
goto out;
175175
break;
176176

177177
case CHIP_LM3556:
178-
reg_val = pdata->pin_tx2 | pdata->ntc_pin | pdata->pass_mode;
178+
reg_val = (u32)pdata->pin_tx2 | (u32)pdata->ntc_pin |
179+
(u32)pdata->pass_mode;
179180
ret = regmap_update_bits(chip->regmap, 0x0A, 0xC4, reg_val);
180181
if (ret < 0)
181182
goto out;

0 commit comments

Comments
 (0)