diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-09-22 17:10:30 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-11-03 18:33:46 -0200 |
commit | 9b6390bd95c65ad4a6c650955fa1e3f18f8a540c (patch) | |
tree | 3e1dcd35d28f0793dd62d1a3ff72b4831890a118 /drivers/media/video/omap3isp/ispccp2.c | |
parent | ed33ac8e0876a3016511ea0aaf9af1d965ee2c44 (diff) |
[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/ispccp2.c')
-rw-r--r-- | drivers/media/video/omap3isp/ispccp2.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/media/video/omap3isp/ispccp2.c b/drivers/media/video/omap3isp/ispccp2.c index 883a2825cb4..904ca8c8b17 100644 --- a/drivers/media/video/omap3isp/ispccp2.c +++ b/drivers/media/video/omap3isp/ispccp2.c @@ -1125,15 +1125,21 @@ static int ccp2_init_entities(struct isp_ccp2_device *ccp2) ret = omap3isp_video_init(&ccp2->video_in, "CCP2"); if (ret < 0) - return ret; + goto error_video; /* Connect the video node to the ccp2 subdev. */ ret = media_entity_create_link(&ccp2->video_in.video.entity, 0, &ccp2->subdev.entity, CCP2_PAD_SINK, 0); if (ret < 0) - return ret; + goto error_link; return 0; + +error_link: + omap3isp_video_cleanup(&ccp2->video_in); +error_video: + media_entity_cleanup(&ccp2->subdev.entity); + return ret; } /* @@ -1171,15 +1177,13 @@ int omap3isp_ccp2_init(struct isp_device *isp) } ret = ccp2_init_entities(ccp2); - if (ret < 0) - goto out; + if (ret < 0) { + regulator_put(ccp2->vdds_csib); + return ret; + } ccp2_reset(ccp2); -out: - if (ret) - omap3isp_ccp2_cleanup(isp); - - return ret; + return 0; } /* |