# \[patch\] backlight/ld9040.c: testing the wrong variable in

- Subsystems: FRAMEBUFFER LAYER, BACKLIGHT CLASS/SUBSYSTEM, THE REST
- Maintainers: Helge Deller, Lee Jones, Daniel Thompson, Jingoo Han, Linus Torvalds
- List: linux-fbdev
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linux-fbdev/2011/03/13149273/t

## \[patch\] backlight/ld9040.c: testing the wrong variable in

- From: Dan Carpenter \<hidden\>
- Date: 2011-03-29 03:19:09 
- Message: https://ratatoskr.run/linux-fbdev/2011/03/13149273.md

```text
We should be testing "bd" here instead of "ld".  It's a copy and
paste bug.

Signed-off-by: Dan Carpenter <redacted>

diff --git a/drivers/video/backlight/ld9040.c b/drivers/video/backlight/ld9040.c
index 7281b25..9e81d69 100644
--- a/drivers/video/backlight/ld9040.c
+++ b/drivers/video/backlight/ld9040.c
@@ -701,8 +701,8 @@ static int ld9040_probe(struct spi_device *spi)
 
 	bd = backlight_device_register("ld9040-bl", &spi->dev,
 		lcd, &ld9040_backlight_ops, NULL);
-	if (IS_ERR(ld)) {
-		ret = PTR_ERR(ld);
+	if (IS_ERR(bd)) {
+		ret = PTR_ERR(bd);
 		goto out_free_lcd;
 	}
 
```

## Re: \[patch\] backlight/ld9040.c: testing the wrong variable in

- From: Donghwa Lee \<hidden\>
- Date: 2011-03-29 04:37:12 
- Message: https://ratatoskr.run/linux-fbdev/2011/03/13149274.md

```text
 On 2011-03-29, Dan Carpenter wrote:
> We should be testing "bd" here instead of "ld".  It's a copy and
> paste bug.
>
> Signed-off-by: Dan Carpenter <redacted>
>
> diff --git a/drivers/video/backlight/ld9040.c b/drivers/video/backlight/ld9040.c
> index 7281b25..9e81d69 100644
> --- a/drivers/video/backlight/ld9040.c
> +++ b/drivers/video/backlight/ld9040.c
> @@ -701,8 +701,8 @@ static int ld9040_probe(struct spi_device *spi)
>  
>  	bd = backlight_device_register("ld9040-bl", &spi->dev,
>  		lcd, &ld9040_backlight_ops, NULL);
> -	if (IS_ERR(ld)) {
> -		ret = PTR_ERR(ld);
> +	if (IS_ERR(bd)) {
> +		ret = PTR_ERR(bd);
>  		goto out_free_lcd;
>  	}
>  
>

Yes, It's my mistake. It has to be changed as you said.

Thank you,

```
