video: fbdev: pxa168fb: Use devm_clk_get

This patch introduces the use of managed resource function
devm_clk_get instead of clk_get and removes corresponding calls
to clk_put in the probe and remove functions.

To be compatible with the change various gotos are replaced with
direct returns, and unneeded label failed_put_clk is dropped.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:
Vaishali Thakkar 2015-08-18 08:58:40 +05:30 committed by Tomi Valkeinen
parent c4e6774de1
commit 7b554088d5

View File

@ -615,7 +615,7 @@ static int pxa168fb_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
clk = clk_get(&pdev->dev, "LCDCLK"); clk = devm_clk_get(&pdev->dev, "LCDCLK");
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
dev_err(&pdev->dev, "unable to get LCDCLK"); dev_err(&pdev->dev, "unable to get LCDCLK");
return PTR_ERR(clk); return PTR_ERR(clk);
@ -624,21 +624,18 @@ static int pxa168fb_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) { if (res == NULL) {
dev_err(&pdev->dev, "no IO memory defined\n"); dev_err(&pdev->dev, "no IO memory defined\n");
ret = -ENOENT; return -ENOENT;
goto failed_put_clk;
} }
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0) {
dev_err(&pdev->dev, "no IRQ defined\n"); dev_err(&pdev->dev, "no IRQ defined\n");
ret = -ENOENT; return -ENOENT;
goto failed_put_clk;
} }
info = framebuffer_alloc(sizeof(struct pxa168fb_info), &pdev->dev); info = framebuffer_alloc(sizeof(struct pxa168fb_info), &pdev->dev);
if (info == NULL) { if (info == NULL) {
ret = -ENOMEM; return -ENOMEM;
goto failed_put_clk;
} }
/* Initialize private data */ /* Initialize private data */
@ -776,8 +773,6 @@ static int pxa168fb_probe(struct platform_device *pdev)
info->screen_base, fbi->fb_start_dma); info->screen_base, fbi->fb_start_dma);
failed_free_info: failed_free_info:
kfree(info); kfree(info);
failed_put_clk:
clk_put(clk);
dev_err(&pdev->dev, "frame buffer device init failed with %d\n", ret); dev_err(&pdev->dev, "frame buffer device init failed with %d\n", ret);
return ret; return ret;
@ -813,7 +808,6 @@ static int pxa168fb_remove(struct platform_device *pdev)
info->screen_base, info->fix.smem_start); info->screen_base, info->fix.smem_start);
clk_disable(fbi->clk); clk_disable(fbi->clk);
clk_put(fbi->clk);
framebuffer_release(info); framebuffer_release(info);