2020-04-28 14:15:47

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH -next] drm/mcde: dsi: Fix return value check in dev_err()

In case of error, the function of_drm_find_bridge() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Signed-off-by: Wei Yongjun <[email protected]>
---
drivers/gpu/drm/mcde/mcde_dsi.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c
index 7af5ebb0c436..e705afc08c4e 100644
--- a/drivers/gpu/drm/mcde/mcde_dsi.c
+++ b/drivers/gpu/drm/mcde/mcde_dsi.c
@@ -1073,10 +1073,9 @@ static int mcde_dsi_bind(struct device *dev, struct device *master,
panel = NULL;

bridge = of_drm_find_bridge(child);
- if (IS_ERR(bridge)) {
- dev_err(dev, "failed to find bridge (%ld)\n",
- PTR_ERR(bridge));
- return PTR_ERR(bridge);
+ if (!bridge) {
+ dev_err(dev, "failed to find bridge\n");
+ return -EINVAL;
}
}
}






2020-04-30 07:32:49

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH -next v2] drm/mcde: dsi: Fix return value check in mcde_dsi_bind()

The of_drm_find_bridge() function returns NULL on error, it doesn't return
error pointers so this check doesn't work.

Fixes: 5fc537bfd000 ("drm/mcde: Add new driver for ST-Ericsson MCDE")
Signed-off-by: Wei Yongjun <[email protected]>
---
v1 - > v2: add fixes and fix the subject
---
drivers/gpu/drm/mcde/mcde_dsi.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c
index 7af5ebb0c436..e705afc08c4e 100644
--- a/drivers/gpu/drm/mcde/mcde_dsi.c
+++ b/drivers/gpu/drm/mcde/mcde_dsi.c
@@ -1073,10 +1073,9 @@ static int mcde_dsi_bind(struct device *dev, struct device *master,
panel = NULL;

bridge = of_drm_find_bridge(child);
- if (IS_ERR(bridge)) {
- dev_err(dev, "failed to find bridge (%ld)\n",
- PTR_ERR(bridge));
- return PTR_ERR(bridge);
+ if (!bridge) {
+ dev_err(dev, "failed to find bridge\n");
+ return -EINVAL;
}
}
}



2020-05-12 11:51:36

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH -next] drm/mcde: dsi: Fix return value check in dev_err()

On Tue, Apr 28, 2020 at 4:13 PM Wei Yongjun <[email protected]> wrote:

> In case of error, the function of_drm_find_bridge() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should be
> replaced with NULL test.
>
> Signed-off-by: Wei Yongjun <[email protected]>

Patch applied! Thanks Wei, sorry for the long delay.

Yours,
Linus Walleij

2020-05-12 12:09:28

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH -next v2] drm/mcde: dsi: Fix return value check in mcde_dsi_bind()

On Thu, Apr 30, 2020 at 9:30 AM Wei Yongjun <[email protected]> wrote:

> The of_drm_find_bridge() function returns NULL on error, it doesn't return
> error pointers so this check doesn't work.
>
> Fixes: 5fc537bfd000 ("drm/mcde: Add new driver for ST-Ericsson MCDE")
> Signed-off-by: Wei Yongjun <[email protected]>
> ---
> v1 - > v2: add fixes and fix the subject

Already applied v1, no big deal anyways, its a nonurgent fix.

Yours,
Linus Walleij

2020-05-12 13:09:00

by Emil Velikov

[permalink] [raw]
Subject: Re: [PATCH -next] drm/mcde: dsi: Fix return value check in dev_err()

Hi all,

On Tue, 12 May 2020 at 12:49, Linus Walleij <[email protected]> wrote:
>
> On Tue, Apr 28, 2020 at 4:13 PM Wei Yongjun <[email protected]> wrote:
>
> > In case of error, the function of_drm_find_bridge() returns NULL pointer
> > not ERR_PTR(). The IS_ERR() test in the return value check should be
> > replaced with NULL test.
> >
> > Signed-off-by: Wei Yongjun <[email protected]>
>
> Patch applied! Thanks Wei, sorry for the long delay.
>
It would be nice if of_drm_find_bridge and of_drm_find_panel were
consistent - either return NULL or an ERR_PTR.
Otherwise the next person using them is likely to get it wrong.

-Emil