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

Liu Ying Ying.Liu at freescale.com
Fri Nov 20 00:14:08 PST 2015


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);
 
-- 
2.5.0



More information about the dri-devel mailing list