diff mbox

[02/10] drm/exynos: Remove explicit freeing using devm_* APIs in exynos_drm_fimc.c

Message ID 1356338031-23674-3-git-send-email-sachin.kamat@linaro.org
State Accepted
Headers show

Commit Message

Sachin Kamat Dec. 24, 2012, 8:33 a.m. UTC
devm_* APIs are device managed and get freed automatically when the
device detaches. Thus explicit freeing is not needed. This saves some
code.

Cc: Eunchul Kim <chulspro.kim@samsung.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/gpu/drm/exynos/exynos_drm_fimc.c |   30 +++++++++---------------------
 1 files changed, 9 insertions(+), 21 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
index 61ea242..ab75150 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
@@ -1742,64 +1742,58 @@  static int __devinit fimc_probe(struct platform_device *pdev)
 	ctx->sclk_fimc_clk = clk_get(dev, "sclk_fimc");
 	if (IS_ERR(ctx->sclk_fimc_clk)) {
 		dev_err(dev, "failed to get src fimc clock.\n");
-		ret = PTR_ERR(ctx->sclk_fimc_clk);
-		goto err_ctx;
+		return PTR_ERR(ctx->sclk_fimc_clk);
 	}
 	clk_enable(ctx->sclk_fimc_clk);
 
 	ctx->fimc_clk = clk_get(dev, "fimc");
 	if (IS_ERR(ctx->fimc_clk)) {
 		dev_err(dev, "failed to get fimc clock.\n");
-		ret = PTR_ERR(ctx->fimc_clk);
 		clk_disable(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");
 	if (IS_ERR(ctx->wb_clk)) {
 		dev_err(dev, "failed to get writeback a clock.\n");
-		ret = PTR_ERR(ctx->wb_clk);
 		clk_disable(ctx->sclk_fimc_clk);
 		clk_put(ctx->sclk_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");
 	if (IS_ERR(ctx->wb_b_clk)) {
 		dev_err(dev, "failed to get writeback b clock.\n");
-		ret = PTR_ERR(ctx->wb_b_clk);
 		clk_disable(ctx->sclk_fimc_clk);
 		clk_put(ctx->sclk_fimc_clk);
 		clk_put(ctx->fimc_clk);
 		clk_put(ctx->wb_clk);
-		goto err_ctx;
+		return PTR_ERR(ctx->wb_b_clk);
 	}
 
 	parent_clk = clk_get(dev, ddata->parent_clk);
 
 	if (IS_ERR(parent_clk)) {
 		dev_err(dev, "failed to get parent clock.\n");
-		ret = PTR_ERR(parent_clk);
 		clk_disable(ctx->sclk_fimc_clk);
 		clk_put(ctx->sclk_fimc_clk);
 		clk_put(ctx->fimc_clk);
 		clk_put(ctx->wb_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)) {
 		dev_err(dev, "failed to set parent.\n");
-		ret = -EINVAL;
 		clk_put(parent_clk);
 		clk_disable(ctx->sclk_fimc_clk);
 		clk_put(ctx->sclk_fimc_clk);
 		clk_put(ctx->fimc_clk);
 		clk_put(ctx->wb_clk);
 		clk_put(ctx->wb_b_clk);
-		goto err_ctx;
+		return -EINVAL;
 	}
 
 	clk_put(parent_clk);
@@ -1825,7 +1819,7 @@  static int __devinit fimc_probe(struct platform_device *pdev)
 	if (!res) {
 		dev_err(dev, "failed to request irq resource.\n");
 		ret = -ENOENT;
-		goto err_get_regs;
+		goto err_clk;
 	}
 
 	ctx->irq = res->start;
@@ -1833,7 +1827,7 @@  static int __devinit fimc_probe(struct platform_device *pdev)
 		IRQF_ONESHOT, "drm_fimc", ctx);
 	if (ret < 0) {
 		dev_err(dev, "failed to request irq.\n");
-		goto err_get_regs;
+		goto err_clk;
 	}
 
 	/* context initailization */
@@ -1879,15 +1873,12 @@  err_ippdrv_register:
 	pm_runtime_disable(dev);
 err_get_irq:
 	free_irq(ctx->irq, ctx);
-err_get_regs:
-	devm_iounmap(dev, ctx->regs);
 err_clk:
 	clk_put(ctx->sclk_fimc_clk);
 	clk_put(ctx->fimc_clk);
 	clk_put(ctx->wb_clk);
 	clk_put(ctx->wb_b_clk);
-err_ctx:
-	devm_kfree(dev, ctx);
+
 	return ret;
 }
 
@@ -1905,15 +1896,12 @@  static int __devexit fimc_remove(struct platform_device *pdev)
 	pm_runtime_disable(dev);
 
 	free_irq(ctx->irq, ctx);
-	devm_iounmap(dev, ctx->regs);
 
 	clk_put(ctx->sclk_fimc_clk);
 	clk_put(ctx->fimc_clk);
 	clk_put(ctx->wb_clk);
 	clk_put(ctx->wb_b_clk);
 
-	devm_kfree(dev, ctx);
-
 	return 0;
 }