Skip to content

Commit 7cea645

Browse files
nathanchanceLee Jones
authored andcommitted
backlight: lm3639: Unconditionally call led_classdev_unregister
Clang warns that the address of a pointer will always evaluated as true in a boolean context. drivers/video/backlight/lm3639_bl.c:403:14: warning: address of 'pchip->cdev_torch' will always evaluate to 'true' [-Wpointer-bool-conversion] if (&pchip->cdev_torch) ~~ ~~~~~~~^~~~~~~~~~ drivers/video/backlight/lm3639_bl.c:405:14: warning: address of 'pchip->cdev_flash' will always evaluate to 'true' [-Wpointer-bool-conversion] if (&pchip->cdev_flash) ~~ ~~~~~~~^~~~~~~~~~ 2 warnings generated. These statements have been present since 2012, introduced by commit 0f59858 ("backlight: add new lm3639 backlight driver"). Given that they have been called unconditionally since then presumably without any issues, removing the always true if statements to fix the warnings without any real world changes. Link: ClangBuiltLinux#119 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
1 parent e6bcca0 commit 7cea645

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/video/backlight/lm3639_bl.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,8 @@ static int lm3639_remove(struct i2c_client *client)
400400

401401
regmap_write(pchip->regmap, REG_ENABLE, 0x00);
402402

403-
if (&pchip->cdev_torch)
404-
led_classdev_unregister(&pchip->cdev_torch);
405-
if (&pchip->cdev_flash)
406-
led_classdev_unregister(&pchip->cdev_flash);
403+
led_classdev_unregister(&pchip->cdev_torch);
404+
led_classdev_unregister(&pchip->cdev_flash);
407405
if (pchip->bled)
408406
device_remove_file(&(pchip->bled->dev), &dev_attr_bled_mode);
409407
return 0;

0 commit comments

Comments
 (0)