# \[PATCH 1/1\] backlight: lp8788: Deletion of an unnecessary check before the function call "backlight\_device\_unregister"

- Subsystems: FRAMEBUFFER LAYER, BACKLIGHT CLASS/SUBSYSTEM, THE REST
- Maintainers: Helge Deller, Lee Jones, Daniel Thompson, Jingoo Han, Linus Torvalds
- List: linux-fbdev
- 9 messages, 3 authors
- Page: https://ratatoskr.run/linux-fbdev/2014/11/4380455/t

## \[PATCH 1/1\] backlight: lp8788: Deletion of an unnecessary check before the function call "backlight\_device\_unregister"

- From: SF Markus Elfring \<hidden\>
- Date: 2014-11-23 16:40:44 
- Message: https://ratatoskr.run/linux-fbdev/2014/11/4380455.md

```text
From: Markus Elfring <redacted>
Date: Sun, 23 Nov 2014 17:33:08 +0100

The backlight_device_unregister() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <redacted>
---
 drivers/video/backlight/lp8788_bl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
index d6c4f6a..24a055c 100644
--- a/drivers/video/backlight/lp8788_bl.c
+++ b/drivers/video/backlight/lp8788_bl.c
@@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
 {
 	struct backlight_device *bl_dev = bl->bl_dev;
 
-	if (bl_dev)
-		backlight_device_unregister(bl_dev);
+	backlight_device_unregister(bl_dev);
 }
 
 static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
-- 
2.1.3

```

## Re: \[PATCH 1/1\] backlight: lp8788: Deletion of an unnecessary check before the function call "backlight\_device\_unregister"

- From: Lee Jones \<hidden\>
- Date: 2014-11-24 10:09:33 
- Message: https://ratatoskr.run/linux-fbdev/2014/11/4380742.md

```text
On Sun, 23 Nov 2014, SF Markus Elfring wrote:

> From: Markus Elfring <redacted>
> Date: Sun, 23 Nov 2014 17:33:08 +0100

What format is this?

Can you use `git format-patch` and `git send-email` instead please?
 
> The backlight_device_unregister() function tests whether its argument is NULL
> and then returns immediately. Thus the test around the call is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <redacted>
> ---
>  drivers/video/backlight/lp8788_bl.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
> index d6c4f6a..24a055c 100644
> --- a/drivers/video/backlight/lp8788_bl.c
> +++ b/drivers/video/backlight/lp8788_bl.c
> @@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
>  {
>  	struct backlight_device *bl_dev = bl->bl_dev;
>  
> -	if (bl_dev)
> -		backlight_device_unregister(bl_dev);
> +	backlight_device_unregister(bl_dev);
>  }
>  
>  static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org â”‚ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
```

## Re: \[PATCH 1/1\] backlight: lp8788: Deletion of an unnecessary check before the function call "backlight\_device\_unregister"

- From: Lee Jones \<hidden\>
- Date: 2014-11-24 10:10:15 
- Message: https://ratatoskr.run/linux-fbdev/2014/11/4380743.md

```text
On Sun, 23 Nov 2014, SF Markus Elfring wrote:

> From: Markus Elfring <redacted>
> Date: Sun, 23 Nov 2014 17:33:08 +0100
> 
> The backlight_device_unregister() function tests whether its argument is NULL
> and then returns immediately. Thus the test around the call is not needed.

Also the $SUBJECT should be less than 75 chars.

> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <redacted>
> ---
>  drivers/video/backlight/lp8788_bl.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
> index d6c4f6a..24a055c 100644
> --- a/drivers/video/backlight/lp8788_bl.c
> +++ b/drivers/video/backlight/lp8788_bl.c
> @@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
>  {
>  	struct backlight_device *bl_dev = bl->bl_dev;
>  
> -	if (bl_dev)
> -		backlight_device_unregister(bl_dev);
> +	backlight_device_unregister(bl_dev);
>  }
>  
>  static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org â”‚ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
```

## \[PATCH v2\] backlight: lp8788: Deletion of a check before backlight\_device\_unregister()

- From: SF Markus Elfring \<hidden\>
- Date: 2014-11-24 18:05:48 
- Message: https://ratatoskr.run/linux-fbdev/2014/11/4381165.md

```text
From: Markus Elfring <redacted>

The backlight_device_unregister() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <redacted>
---
 drivers/video/backlight/lp8788_bl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
index d6c4f6a..24a055c 100644
--- a/drivers/video/backlight/lp8788_bl.c
+++ b/drivers/video/backlight/lp8788_bl.c
@@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
 {
 	struct backlight_device *bl_dev = bl->bl_dev;
 
-	if (bl_dev)
-		backlight_device_unregister(bl_dev);
+	backlight_device_unregister(bl_dev);
 }
 
 static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
-- 
2.1.3

```

## Re: \[PATCH v2\] backlight: lp8788: Deletion of a check before backlight\_device\_unregister()

- From: SF Markus Elfring \<hidden\>
- Date: 2015-06-28 12:07:54 
- Message: https://ratatoskr.run/linux-fbdev/2015/06/4524125.md

```text
> From: Markus Elfring <redacted>
> 
> The backlight_device_unregister() function tests whether its argument is NULL
> and then returns immediately. Thus the test around the call is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <redacted>
> ---
>  drivers/video/backlight/lp8788_bl.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
> index d6c4f6a..24a055c 100644
> --- a/drivers/video/backlight/lp8788_bl.c
> +++ b/drivers/video/backlight/lp8788_bl.c
> @@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
>  {
>  	struct backlight_device *bl_dev = bl->bl_dev;
>  
> -	if (bl_dev)
> -		backlight_device_unregister(bl_dev);
> +	backlight_device_unregister(bl_dev);
>  }
>  
>  static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
> 

Would you like to integrate this update suggestion
into another source code repository?

Regards,
Markus
```

## Re: \[PATCH v2\] backlight: lp8788: Deletion of a check before backlight\_device\_unregister()

- From: Lee Jones \<hidden\>
- Date: 2015-07-01 08:06:31 
- Message: https://ratatoskr.run/linux-fbdev/2015/07/4525675.md

```text
On Sun, 28 Jun 2015, SF Markus Elfring wrote:

> > From: Markus Elfring <redacted>
> > 
> > The backlight_device_unregister() function tests whether its argument is NULL
> > and then returns immediately. Thus the test around the call is not needed.
> > 
> > This issue was detected by using the Coccinelle software.
> > 
> > Signed-off-by: Markus Elfring <redacted>
> > ---
> >  drivers/video/backlight/lp8788_bl.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
> > index d6c4f6a..24a055c 100644
> > --- a/drivers/video/backlight/lp8788_bl.c
> > +++ b/drivers/video/backlight/lp8788_bl.c
> > @@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
> >  {
> >  	struct backlight_device *bl_dev = bl->bl_dev;
> >  
> > -	if (bl_dev)
> > -		backlight_device_unregister(bl_dev);
> > +	backlight_device_unregister(bl_dev);
> >  }
> >  
> >  static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
> > 
> 
> Would you like to integrate this update suggestion
> into another source code repository?

If this patch has not received any attention in some time, it's
possible that it may have slipped through the gaps.  Please
re-submit the set.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org â”‚ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
```

## \[PATCH v3\] video-lp8788: Delete a check before backlight\_device\_unregister()

- From: SF Markus Elfring \<hidden\>
- Date: 2015-07-01 10:30:47 
- Message: https://ratatoskr.run/linux-fbdev/2015/07/4525775.md

```text
From: Markus Elfring <redacted>
Date: Wed, 1 Jul 2015 12:08:31 +0200

The backlight_device_unregister() function tests whether its argument
is NULL and then returns immediately.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <redacted>
---
 drivers/video/backlight/lp8788_bl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
index e418d5b..5d583d7 100644
--- a/drivers/video/backlight/lp8788_bl.c
+++ b/drivers/video/backlight/lp8788_bl.c
@@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
 {
 	struct backlight_device *bl_dev = bl->bl_dev;
 
-	if (bl_dev)
-		backlight_device_unregister(bl_dev);
+	backlight_device_unregister(bl_dev);
 }
 
 static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
-- 
2.4.5

```

## Re: \[PATCH v3\] video-lp8788: Delete a check before backlight\_device\_unregister()

- From: Jingoo Han \<jingoohan1@gmail.com\>
- Date: 2015-07-02 04:44:30 
- Message: https://ratatoskr.run/linux-fbdev/2015/07/4526291.md

```text

> On 2015. 7. 1., at PM 7:30, SF Markus Elfring [ref] wrote:
> 
> From: Markus Elfring <redacted>
> Date: Wed, 1 Jul 2015 12:08:31 +0200
> 
> The backlight_device_unregister() function tests whether its argument
> is NULL and then returns immediately.
> Thus the test around the call is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <redacted>

It looks good.

Acked-by: Jingoo Han <jingoohan1@gmail.com>

> ---
> drivers/video/backlight/lp8788_bl.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
> index e418d5b..5d583d7 100644
> --- a/drivers/video/backlight/lp8788_bl.c
> +++ b/drivers/video/backlight/lp8788_bl.c
> @@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
> {
>    struct backlight_device *bl_dev = bl->bl_dev;
> 
> -    if (bl_dev)
> -        backlight_device_unregister(bl_dev);
> +    backlight_device_unregister(bl_dev);
> }
> 
> static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
> -- 
> 2.4.5
> 
```

## Re: \[PATCH v3\] video-lp8788: Delete a check before backlight\_device\_unregister()

- From: Lee Jones \<hidden\>
- Date: 2015-07-07 07:13:13 
- Message: https://ratatoskr.run/linux-fbdev/2015/07/4528715.md

```text
On Wed, 01 Jul 2015, SF Markus Elfring wrote:

> From: Markus Elfring <redacted>
> Date: Wed, 1 Jul 2015 12:08:31 +0200
> 
> The backlight_device_unregister() function tests whether its argument
> is NULL and then returns immediately.
> Thus the test around the call is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <redacted>
> ---
>  drivers/video/backlight/lp8788_bl.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied, thanks.

> diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
> index e418d5b..5d583d7 100644
> --- a/drivers/video/backlight/lp8788_bl.c
> +++ b/drivers/video/backlight/lp8788_bl.c
> @@ -221,8 +221,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
>  {
>  	struct backlight_device *bl_dev = bl->bl_dev;
>  
> -	if (bl_dev)
> -		backlight_device_unregister(bl_dev);
> +	backlight_device_unregister(bl_dev);
>  }
>  
>  static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org â”‚ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
```
