summaryrefslogtreecommitdiffstats
path: root/drivers/staging/media
diff options
context:
space:
mode:
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>2016-03-22 22:22:41 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-28 07:30:36 -0700
commitf90272f432f7515044d9e13a6fa2c8bf1ac14838 (patch)
treeefefb22e9b3979b92e562621bf14f1eadb241b07 /drivers/staging/media
parent4ada295da12e9d0647801577cef37cfc48d41b38 (diff)
downloadblackbird-op-linux-f90272f432f7515044d9e13a6fa2c8bf1ac14838.tar.gz
blackbird-op-linux-f90272f432f7515044d9e13a6fa2c8bf1ac14838.zip
staging: media: omap1: Replace clk_get with devm_clk_get
devm_clk_get allocated resources get released when a driver detaches. Replace clk_get with devm_clk_get and remove corresponding data releasing function clk_put from probe and remove functions of a platform device. Also remove an unnecessary label. This change was made with the help of the following Coccinelle semantic patch: @platform@ identifier p, probefn, removefn; @@ struct platform_driver p = { .probe = probefn, .remove = removefn, }; @prb@ identifier platform.probefn, pdev; expression e; @@ probefn(struct platform_device *pdev, ...) { ... e = - clk_get + devm_clk_get (...); ... ?- clk_put(...); ... } @remove depends on prb@ identifier platform.removefn; @@ removefn(...) { ... ?- clk_put(...); ... } Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/media')
-rw-r--r--drivers/staging/media/omap1/omap1_camera.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/staging/media/omap1/omap1_camera.c b/drivers/staging/media/omap1/omap1_camera.c
index bd721e35474a..bd001804ed47 100644
--- a/drivers/staging/media/omap1/omap1_camera.c
+++ b/drivers/staging/media/omap1/omap1_camera.c
@@ -1576,17 +1576,14 @@ static int omap1_cam_probe(struct platform_device *pdev)
goto exit;
}
- clk = clk_get(&pdev->dev, "armper_ck");
- if (IS_ERR(clk)) {
- err = PTR_ERR(clk);
- goto exit;
- }
+ clk = devm_clk_get(&pdev->dev, "armper_ck");
+ if (IS_ERR(clk))
+ return PTR_ERR(clk);
pcdev = kzalloc(sizeof(*pcdev) + resource_size(res), GFP_KERNEL);
if (!pcdev) {
dev_err(&pdev->dev, "Could not allocate pcdev\n");
- err = -ENOMEM;
- goto exit_put_clk;
+ return -ENOMEM;
}
pcdev->res = res;
@@ -1685,8 +1682,6 @@ exit_release:
release_mem_region(res->start, resource_size(res));
exit_kfree:
kfree(pcdev);
-exit_put_clk:
- clk_put(clk);
exit:
return err;
}
@@ -1709,8 +1704,6 @@ static int omap1_cam_remove(struct platform_device *pdev)
res = pcdev->res;
release_mem_region(res->start, resource_size(res));
- clk_put(pcdev->clk);
-
kfree(pcdev);
dev_info(&pdev->dev, "OMAP1 Camera Interface driver unloaded\n");
OpenPOWER on IntegriCloud