提交 87acdde5 编写于 作者: S Sachin Kamat 提交者: Inki Dae

drm/exynos: Remove explicit freeing using devm_* APIs in exynos_drm_fimc.c

devm_* APIs are device managed and get freed automatically when the
device detaches. Thus explicit freeing is not needed. This saves some
code.
Signed-off-by: NSachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: NInki Dae <inki.dae@samsung.com>
上级 bfb6ed26
...@@ -1741,64 +1741,58 @@ static int __devinit fimc_probe(struct platform_device *pdev) ...@@ -1741,64 +1741,58 @@ static int __devinit fimc_probe(struct platform_device *pdev)
ctx->sclk_fimc_clk = clk_get(dev, "sclk_fimc"); ctx->sclk_fimc_clk = clk_get(dev, "sclk_fimc");
if (IS_ERR(ctx->sclk_fimc_clk)) { if (IS_ERR(ctx->sclk_fimc_clk)) {
dev_err(dev, "failed to get src fimc clock.\n"); dev_err(dev, "failed to get src fimc clock.\n");
ret = PTR_ERR(ctx->sclk_fimc_clk); return PTR_ERR(ctx->sclk_fimc_clk);
goto err_ctx;
} }
clk_enable(ctx->sclk_fimc_clk); clk_enable(ctx->sclk_fimc_clk);
ctx->fimc_clk = clk_get(dev, "fimc"); ctx->fimc_clk = clk_get(dev, "fimc");
if (IS_ERR(ctx->fimc_clk)) { if (IS_ERR(ctx->fimc_clk)) {
dev_err(dev, "failed to get fimc clock.\n"); dev_err(dev, "failed to get fimc clock.\n");
ret = PTR_ERR(ctx->fimc_clk);
clk_disable(ctx->sclk_fimc_clk); clk_disable(ctx->sclk_fimc_clk);
clk_put(ctx->sclk_fimc_clk); clk_put(ctx->sclk_fimc_clk);
goto err_ctx; return PTR_ERR(ctx->fimc_clk);
} }
ctx->wb_clk = clk_get(dev, "pxl_async0"); ctx->wb_clk = clk_get(dev, "pxl_async0");
if (IS_ERR(ctx->wb_clk)) { if (IS_ERR(ctx->wb_clk)) {
dev_err(dev, "failed to get writeback a clock.\n"); dev_err(dev, "failed to get writeback a clock.\n");
ret = PTR_ERR(ctx->wb_clk);
clk_disable(ctx->sclk_fimc_clk); clk_disable(ctx->sclk_fimc_clk);
clk_put(ctx->sclk_fimc_clk); clk_put(ctx->sclk_fimc_clk);
clk_put(ctx->fimc_clk); clk_put(ctx->fimc_clk);
goto err_ctx; return PTR_ERR(ctx->wb_clk);
} }
ctx->wb_b_clk = clk_get(dev, "pxl_async1"); ctx->wb_b_clk = clk_get(dev, "pxl_async1");
if (IS_ERR(ctx->wb_b_clk)) { if (IS_ERR(ctx->wb_b_clk)) {
dev_err(dev, "failed to get writeback b clock.\n"); dev_err(dev, "failed to get writeback b clock.\n");
ret = PTR_ERR(ctx->wb_b_clk);
clk_disable(ctx->sclk_fimc_clk); clk_disable(ctx->sclk_fimc_clk);
clk_put(ctx->sclk_fimc_clk); clk_put(ctx->sclk_fimc_clk);
clk_put(ctx->fimc_clk); clk_put(ctx->fimc_clk);
clk_put(ctx->wb_clk); clk_put(ctx->wb_clk);
goto err_ctx; return PTR_ERR(ctx->wb_b_clk);
} }
parent_clk = clk_get(dev, ddata->parent_clk); parent_clk = clk_get(dev, ddata->parent_clk);
if (IS_ERR(parent_clk)) { if (IS_ERR(parent_clk)) {
dev_err(dev, "failed to get parent clock.\n"); dev_err(dev, "failed to get parent clock.\n");
ret = PTR_ERR(parent_clk);
clk_disable(ctx->sclk_fimc_clk); clk_disable(ctx->sclk_fimc_clk);
clk_put(ctx->sclk_fimc_clk); clk_put(ctx->sclk_fimc_clk);
clk_put(ctx->fimc_clk); clk_put(ctx->fimc_clk);
clk_put(ctx->wb_clk); clk_put(ctx->wb_clk);
clk_put(ctx->wb_b_clk); clk_put(ctx->wb_b_clk);
goto err_ctx; return PTR_ERR(parent_clk);
} }
if (clk_set_parent(ctx->sclk_fimc_clk, parent_clk)) { if (clk_set_parent(ctx->sclk_fimc_clk, parent_clk)) {
dev_err(dev, "failed to set parent.\n"); dev_err(dev, "failed to set parent.\n");
ret = -EINVAL;
clk_put(parent_clk); clk_put(parent_clk);
clk_disable(ctx->sclk_fimc_clk); clk_disable(ctx->sclk_fimc_clk);
clk_put(ctx->sclk_fimc_clk); clk_put(ctx->sclk_fimc_clk);
clk_put(ctx->fimc_clk); clk_put(ctx->fimc_clk);
clk_put(ctx->wb_clk); clk_put(ctx->wb_clk);
clk_put(ctx->wb_b_clk); clk_put(ctx->wb_b_clk);
goto err_ctx; return -EINVAL;
} }
clk_put(parent_clk); clk_put(parent_clk);
...@@ -1824,7 +1818,7 @@ static int __devinit fimc_probe(struct platform_device *pdev) ...@@ -1824,7 +1818,7 @@ static int __devinit fimc_probe(struct platform_device *pdev)
if (!res) { if (!res) {
dev_err(dev, "failed to request irq resource.\n"); dev_err(dev, "failed to request irq resource.\n");
ret = -ENOENT; ret = -ENOENT;
goto err_get_regs; goto err_clk;
} }
ctx->irq = res->start; ctx->irq = res->start;
...@@ -1832,7 +1826,7 @@ static int __devinit fimc_probe(struct platform_device *pdev) ...@@ -1832,7 +1826,7 @@ static int __devinit fimc_probe(struct platform_device *pdev)
IRQF_ONESHOT, "drm_fimc", ctx); IRQF_ONESHOT, "drm_fimc", ctx);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "failed to request irq.\n"); dev_err(dev, "failed to request irq.\n");
goto err_get_regs; goto err_clk;
} }
/* context initailization */ /* context initailization */
...@@ -1878,15 +1872,12 @@ static int __devinit fimc_probe(struct platform_device *pdev) ...@@ -1878,15 +1872,12 @@ static int __devinit fimc_probe(struct platform_device *pdev)
pm_runtime_disable(dev); pm_runtime_disable(dev);
err_get_irq: err_get_irq:
free_irq(ctx->irq, ctx); free_irq(ctx->irq, ctx);
err_get_regs:
devm_iounmap(dev, ctx->regs);
err_clk: err_clk:
clk_put(ctx->sclk_fimc_clk); clk_put(ctx->sclk_fimc_clk);
clk_put(ctx->fimc_clk); clk_put(ctx->fimc_clk);
clk_put(ctx->wb_clk); clk_put(ctx->wb_clk);
clk_put(ctx->wb_b_clk); clk_put(ctx->wb_b_clk);
err_ctx:
devm_kfree(dev, ctx);
return ret; return ret;
} }
...@@ -1904,15 +1895,12 @@ static int __devexit fimc_remove(struct platform_device *pdev) ...@@ -1904,15 +1895,12 @@ static int __devexit fimc_remove(struct platform_device *pdev)
pm_runtime_disable(dev); pm_runtime_disable(dev);
free_irq(ctx->irq, ctx); free_irq(ctx->irq, ctx);
devm_iounmap(dev, ctx->regs);
clk_put(ctx->sclk_fimc_clk); clk_put(ctx->sclk_fimc_clk);
clk_put(ctx->fimc_clk); clk_put(ctx->fimc_clk);
clk_put(ctx->wb_clk); clk_put(ctx->wb_clk);
clk_put(ctx->wb_b_clk); clk_put(ctx->wb_b_clk);
devm_kfree(dev, ctx);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册