2015-11-06 14:37:04

by Liu Ying

[permalink] [raw]
Subject: [PATCH v2] drm/imx: ipuv3-crtc: Return error if ipu_plane_init() fails for primary plane

For primary plane initialization failure cases, ipu_plane_init() may return
a pointer encoded by ERR_PTR(). So, we should bailout instead of using that
pointer blindly.

Signed-off-by: Liu Ying <[email protected]>
---
v1->v2:
* Trivial commit message fix.
* Rebase onto Phillip's patch[1].
[1] http://www.spinics.net/lists/dri-devel/msg93700.html

drivers/gpu/drm/imx/ipuv3-crtc.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
index 872183a..35a77e5 100644
--- a/drivers/gpu/drm/imx/ipuv3-crtc.c
+++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
@@ -361,6 +361,10 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc,
dp = IPU_DP_FLOW_SYNC_BG;
ipu_crtc->plane[0] = ipu_plane_init(drm, ipu, pdata->dma[0], dp, 0,
DRM_PLANE_TYPE_PRIMARY);
+ if (IS_ERR(ipu_crtc->plane[0])) {
+ ret = PTR_ERR(ipu_crtc->plane[0]);
+ goto err_put_resources;
+ }

ret = imx_drm_add_crtc(drm, &ipu_crtc->base, &ipu_crtc->imx_crtc,
&ipu_crtc->plane[0]->base, &ipu_crtc_helper_funcs,
--
2.5.0


2015-11-06 15:25:09

by Philipp Zabel

[permalink] [raw]
Subject: Re: [PATCH v2] drm/imx: ipuv3-crtc: Return error if ipu_plane_init() fails for primary plane

Am Freitag, den 06.11.2015, 22:42 +0800 schrieb Liu Ying:
> For primary plane initialization failure cases, ipu_plane_init() may return
> a pointer encoded by ERR_PTR(). So, we should bailout instead of using that
> pointer blindly.
>
> Signed-off-by: Liu Ying <[email protected]>
> ---
> v1->v2:
> * Trivial commit message fix.
> * Rebase onto Phillip's patch[1].
> [1] http://www.spinics.net/lists/dri-devel/msg93700.html
>
> drivers/gpu/drm/imx/ipuv3-crtc.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
> index 872183a..35a77e5 100644
> --- a/drivers/gpu/drm/imx/ipuv3-crtc.c
> +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
> @@ -361,6 +361,10 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc,
> dp = IPU_DP_FLOW_SYNC_BG;
> ipu_crtc->plane[0] = ipu_plane_init(drm, ipu, pdata->dma[0], dp, 0,
> DRM_PLANE_TYPE_PRIMARY);
> + if (IS_ERR(ipu_crtc->plane[0])) {
> + ret = PTR_ERR(ipu_crtc->plane[0]);
> + goto err_put_resources;
> + }
>
> ret = imx_drm_add_crtc(drm, &ipu_crtc->base, &ipu_crtc->imx_crtc,
> &ipu_crtc->plane[0]->base, &ipu_crtc_helper_funcs,

Applied, thanks.

regards
Philipp