# \[patch v2\] fbdev: sh\_mobile\_lcdc: checking NULL instead of IS\_ERR()

- Subsystems: FRAMEBUFFER LAYER, THE REST
- Maintainers: Helge Deller, Linus Torvalds
- List: linux-fbdev
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linux-fbdev/2011/03/13149291/t

## \[patch v2\] fbdev: sh\_mobile\_lcdc: checking NULL instead of IS\_ERR()

- From: Dan Carpenter \<hidden\>
- Date: 2011-03-21 15:03:13 
- Message: https://ratatoskr.run/linux-fbdev/2011/03/13149291.md

```text
backlight_device_register() returns an ERR_PTR.  It doesn't return NULL.

Signed-off-by: Dan Carpenter <redacted>
---
V2:  print the error code as well.
This patch is againts linux-next, in case you missed that earlier.

diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index bf2629f..757665b 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -1088,8 +1088,9 @@ static struct backlight_device *sh_mobile_lcdc_bl_probe(struct device *parent,
 
 	bl = backlight_device_register(ch->cfg.bl_info.name, parent, ch,
 				       &sh_mobile_lcdc_bl_ops, NULL);
-	if (!bl) {
-		dev_err(parent, "unable to register backlight device\n");
+	if (IS_ERR(bl)) {
+		dev_err(parent, "unable to register backlight device: %ld\n",
+			PTR_ERR(bl));
 		return NULL;
 	}
 
```

## Re: \[patch v2\] fbdev: sh\_mobile\_lcdc: checking NULL instead of IS\_ERR()

- From: Paul Mundt \<hidden\>
- Date: 2011-03-22 07:09:43 
- Message: https://ratatoskr.run/linux-fbdev/2011/03/13149292.md

```text
On Mon, Mar 21, 2011 at 06:03:13PM +0300, Dan Carpenter wrote:
> backlight_device_register() returns an ERR_PTR.  It doesn't return NULL.
> 
> Signed-off-by: Dan Carpenter <redacted>
> ---
> V2:  print the error code as well.
> This patch is againts linux-next, in case you missed that earlier.
> 
Applied, thanks.
```
