[PATCH 2/5] drm/imx: ipuv3 crtc: Cleanup ipu planes in ipu_crtc_init() when necessary

Philipp Zabel p.zabel at pengutronix.de
Mon Nov 23 03:48:10 PST 2015


Am Freitag, den 20.11.2015, 16:14 +0800 schrieb Liu Ying:
> To avoid memory leakage, we need to cleanup the initialized ipu planes in
> the bailout path of ipu_crtc_init().
> 
> Signed-off-by: Liu Ying <Ying.Liu at freescale.com>
> ---
> This patch applies to the imx-drm/fixes branch of Philipp Zabel's open git.
> 
>  drivers/gpu/drm/imx/ipuv3-crtc.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
> index 67813ca..59f44df 100644
> --- a/drivers/gpu/drm/imx/ipuv3-crtc.c
> +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
> @@ -371,7 +371,7 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc,
>  			ipu_crtc->dev->of_node);
>  	if (ret) {
>  		dev_err(ipu_crtc->dev, "adding crtc failed with %d.\n", ret);
> -		goto err_put_resources;
> +		goto err_cleanup_plane0;
>  	}
>  
>  	ret = ipu_plane_get_resources(ipu_crtc->plane[0]);
> @@ -402,9 +402,14 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc,
>  	return 0;
>  
>  err_put_plane_res:
> +	if (ipu_crtc->plane[1])
> +		ipu_plane_cleanup(ipu_crtc->plane[1]);
> +
>  	ipu_plane_put_resources(ipu_crtc->plane[0]);
>  err_remove_crtc:
>  	imx_drm_remove_crtc(ipu_crtc->imx_crtc);
> +err_cleanup_plane0:
> +	ipu_plane_cleanup(ipu_crtc->plane[0]);
>  err_put_resources:
>  	ipu_put_resources(ipu_crtc);

I think we can use ipu_plane_destroy as-is instead of
ipu_plane_put_resources + ipu_plane_cleanup.

regards
Philipp



More information about the dri-devel mailing list