summaryrefslogtreecommitdiff
path: root/drivers/media/video/s5p-fimc/fimc-mdevice.c
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2012-01-30 18:37:59 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-03-08 14:40:40 +0400
commit6d91a51ae1cb597100e17a75370bb2ad9c7da6d6 (patch)
tree38c4466f473c3d600850be2b9c9d15631b3daaea /drivers/media/video/s5p-fimc/fimc-mdevice.c
parent2def9946c3dfb7fd8ff47af7499bb3f6b5a5743f (diff)
downloadlinux-6d91a51ae1cb597100e17a75370bb2ad9c7da6d6.tar.xz
[media] s5p-fimc: Convert to the device managed resources
The devm_* functions are used in the platform device probe() for data that is freed on driver removal. The managed device layer takes care of undoing actions taken in the probe callback() and freeing resources on driver detach. This eliminates the need for manually releasing resources and simplifies error handling. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/s5p-fimc/fimc-mdevice.c')
-rw-r--r--drivers/media/video/s5p-fimc/fimc-mdevice.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-mdevice.c b/drivers/media/video/s5p-fimc/fimc-mdevice.c
index 8ea4ee116e46..087ea098ea29 100644
--- a/drivers/media/video/s5p-fimc/fimc-mdevice.c
+++ b/drivers/media/video/s5p-fimc/fimc-mdevice.c
@@ -753,7 +753,7 @@ static int __devinit fimc_md_probe(struct platform_device *pdev)
struct fimc_md *fmd;
int ret;
- fmd = kzalloc(sizeof(struct fimc_md), GFP_KERNEL);
+ fmd = devm_kzalloc(&pdev->dev, sizeof(*fmd), GFP_KERNEL);
if (!fmd)
return -ENOMEM;
@@ -774,7 +774,7 @@ static int __devinit fimc_md_probe(struct platform_device *pdev)
ret = v4l2_device_register(&pdev->dev, &fmd->v4l2_dev);
if (ret < 0) {
v4l2_err(v4l2_dev, "Failed to register v4l2_device: %d\n", ret);
- goto err1;
+ return ret;
}
ret = media_device_register(&fmd->media_dev);
if (ret < 0) {
@@ -816,8 +816,6 @@ err3:
fimc_md_unregister_entities(fmd);
err2:
v4l2_device_unregister(&fmd->v4l2_dev);
-err1:
- kfree(fmd);
return ret;
}
@@ -831,7 +829,6 @@ static int __devexit fimc_md_remove(struct platform_device *pdev)
fimc_md_unregister_entities(fmd);
media_device_unregister(&fmd->media_dev);
fimc_md_put_clocks(fmd);
- kfree(fmd);
return 0;
}