# \[PATCH -next\] video: ARM CLCD: fix return value check in versatile\_clcd\_init\_panel()

- Subsystems: FRAMEBUFFER LAYER, THE REST
- Maintainers: Helge Deller, Linus Torvalds
- List: linux-fbdev
- 3 messages, 3 authors
- Page: https://ratatoskr.run/linux-fbdev/2016/08/13466584/t

## \[PATCH -next\] video: ARM CLCD: fix return value check in versatile\_clcd\_init\_panel()

- From: Wei Yongjun \<hidden\>
- Date: 2016-08-13 01:26:26 
- Message: https://ratatoskr.run/linux-fbdev/2016/08/13466584.md

```text
In case of error, the function syscon_node_to_regmap() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Fixes: 25348160e9a4 ("video: ARM CLCD: add special panel hook for Versatiles")
Signed-off-by: Wei Yongjun <redacted>
---
 drivers/video/fbdev/amba-clcd-versatile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/amba-clcd-versatile.c b/drivers/video/fbdev/amba-clcd-versatile.c
index 9a90817..56161f9 100644
--- a/drivers/video/fbdev/amba-clcd-versatile.c
+++ b/drivers/video/fbdev/amba-clcd-versatile.c
@@ -528,9 +528,9 @@ int versatile_clcd_init_panel(struct clcd_fb *fb,
 	versatile_clcd_type = (enum versatile_clcd)clcd_id->data;
 
 	map = syscon_node_to_regmap(np);
-	if (!map) {
+	if (IS_ERR(map)) {
 		dev_err(dev, "no Versatile syscon regmap\n");
-		return -ENODEV;
+		return PTR_ERR(map);
 	}
 
 	switch (versatile_clcd_type) {

```

## Re: \[PATCH -next\] video: ARM CLCD: fix return value check in versatile\_clcd\_init\_panel()

- From: Linus Walleij \<hidden\>
- Date: 2016-08-19 09:07:03 
- Message: https://ratatoskr.run/linux-fbdev/2016/08/13466585.md

```text
On Sat, Aug 13, 2016 at 3:26 AM, Wei Yongjun [ref] wrote:

> In case of error, the function syscon_node_to_regmap() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check should
> be replaced with IS_ERR().
>
> Fixes: 25348160e9a4 ("video: ARM CLCD: add special panel hook for Versatiles")
> Signed-off-by: Wei Yongjun <redacted>

Reviewed-by: Linus Walleij <redacted>

Thanks for fixing my stupid mistake Wei!

Yours,
Linus Walleij
```

## Re: \[PATCH -next\] video: ARM CLCD: fix return value check in versatile\_clcd\_init\_panel()

- From: Tomi Valkeinen \<hidden\>
- Date: 2016-08-30 08:37:43 
- Message: https://ratatoskr.run/linux-fbdev/2016/08/13466586.md

```text


On 13/08/16 04:26, Wei Yongjun wrote:
> In case of error, the function syscon_node_to_regmap() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check should
> be replaced with IS_ERR().
> 
> Fixes: 25348160e9a4 ("video: ARM CLCD: add special panel hook for Versatiles")
> Signed-off-by: Wei Yongjun <redacted>
> ---
>  drivers/video/fbdev/amba-clcd-versatile.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/fbdev/amba-clcd-versatile.c b/drivers/video/fbdev/amba-clcd-versatile.c
> index 9a90817..56161f9 100644
> --- a/drivers/video/fbdev/amba-clcd-versatile.c
> +++ b/drivers/video/fbdev/amba-clcd-versatile.c
> @@ -528,9 +528,9 @@ int versatile_clcd_init_panel(struct clcd_fb *fb,
>  	versatile_clcd_type = (enum versatile_clcd)clcd_id->data;
>  
>  	map = syscon_node_to_regmap(np);
> -	if (!map) {
> +	if (IS_ERR(map)) {
>  		dev_err(dev, "no Versatile syscon regmap\n");
> -		return -ENODEV;
> +		return PTR_ERR(map);
>  	}
>  
>  	switch (versatile_clcd_type) {
> 

Thanks, queued for v4.9.

 Tomi

```
