summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/omap3isp/ispcsi2.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-09-22 17:10:30 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-03 18:33:46 -0200
commit9b6390bd95c65ad4a6c650955fa1e3f18f8a540c (patch)
tree3e1dcd35d28f0793dd62d1a3ff72b4831890a118 /drivers/media/video/omap3isp/ispcsi2.c
parented33ac8e0876a3016511ea0aaf9af1d965ee2c44 (diff)
downloadtalos-op-linux-9b6390bd95c65ad4a6c650955fa1e3f18f8a540c.tar.gz
talos-op-linux-9b6390bd95c65ad4a6c650955fa1e3f18f8a540c.zip
[media] omap3isp: Fix memory leaks in initialization error paths
Make sure all modules init functions clean up after themselves in case of error. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reported-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/omap3isp/ispcsi2.c')
-rw-r--r--drivers/media/video/omap3isp/ispcsi2.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/media/video/omap3isp/ispcsi2.c b/drivers/media/video/omap3isp/ispcsi2.c
index 2c9bffcdc5c9..0c5f1cb9d99d 100644
--- a/drivers/media/video/omap3isp/ispcsi2.c
+++ b/drivers/media/video/omap3isp/ispcsi2.c
@@ -1259,15 +1259,21 @@ static int csi2_init_entities(struct isp_csi2_device *csi2)
ret = omap3isp_video_init(&csi2->video_out, "CSI2a");
if (ret < 0)
- return ret;
+ goto error_video;
/* Connect the CSI2 subdev to the video node. */
ret = media_entity_create_link(&csi2->subdev.entity, CSI2_PAD_SOURCE,
&csi2->video_out.video.entity, 0, 0);
if (ret < 0)
- return ret;
+ goto error_link;
return 0;
+
+error_link:
+ omap3isp_video_cleanup(&csi2->video_out);
+error_video:
+ media_entity_cleanup(&csi2->subdev.entity);
+ return ret;
}
/*
@@ -1289,7 +1295,7 @@ int omap3isp_csi2_init(struct isp_device *isp)
ret = csi2_init_entities(csi2a);
if (ret < 0)
- goto fail;
+ return ret;
if (isp->revision == ISP_REVISION_15_0) {
csi2c->isp = isp;
@@ -1302,9 +1308,6 @@ int omap3isp_csi2_init(struct isp_device *isp)
}
return 0;
-fail:
- omap3isp_csi2_cleanup(isp);
- return ret;
}
/*
OpenPOWER on IntegriCloud