2012-11-08 06:45:30

by Daniel Jeong

[permalink] [raw]
Subject: [PATCH]backlight: lm3639: fix coccinelle warning.

From: "G.Shark Jeong" <[email protected]>

Fix coccinelle warning.

Signed-off-by: G.Shark Jeong <[email protected]>
---
drivers/video/backlight/lm3639_bl.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/backlight/lm3639_bl.c b/drivers/video/backlight/lm3639_bl.c
index 585949b..868a9da 100644
--- a/drivers/video/backlight/lm3639_bl.c
+++ b/drivers/video/backlight/lm3639_bl.c
@@ -403,9 +403,9 @@ static int __devexit lm3639_remove(struct i2c_client *client)

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

- if (&pchip->cdev_torch)
+ if ((&pchip->cdev_torch)!=NULL)
led_classdev_unregister(&pchip->cdev_torch);
- if (&pchip->cdev_flash)
+ if ((&pchip->cdev_flash)!=NULL)
led_classdev_unregister(&pchip->cdev_flash);
if (pchip->bled) {
device_remove_file(&(pchip->bled->dev), &dev_attr_bled_mode);
--
1.7.5.4


2012-11-08 20:27:27

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH]backlight: lm3639: fix coccinelle warning.

On Thu, 8 Nov 2012 15:44:49 +0900
"G.Shark Jeong" <[email protected]> wrote:

> From: "G.Shark Jeong" <[email protected]>
>
> Fix coccinelle warning.

Please always quote the warning or error message text in the changelog
when fixing an error or warning.

> diff --git a/drivers/video/backlight/lm3639_bl.c b/drivers/video/backlight/lm3639_bl.c
> index 585949b..868a9da 100644
> --- a/drivers/video/backlight/lm3639_bl.c
> +++ b/drivers/video/backlight/lm3639_bl.c
> @@ -403,9 +403,9 @@ static int __devexit lm3639_remove(struct i2c_client *client)
>
> regmap_write(pchip->regmap, REG_ENABLE, 0x00);
>
> - if (&pchip->cdev_torch)
> + if ((&pchip->cdev_torch)!=NULL)
> led_classdev_unregister(&pchip->cdev_torch);
> - if (&pchip->cdev_flash)
> + if ((&pchip->cdev_flash)!=NULL)

Please use scripts/checkpatch.pl.



This code is just pointless. The expression "&anything" will never
evaluate to NULL.