[PATCH 08/10] drm/exynos: Remove explicit freeing using devm_* APIs in exynos_drm_gsc.c

Sachin Kamat sachin.kamat at linaro.org
Mon Dec 24 00:33:49 PST 2012


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 at samsung.com>
Signed-off-by: Sachin Kamat <sachin.kamat at linaro.org>
---
 drivers/gpu/drm/exynos/exynos_drm_gsc.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
index 5639353..3b47a7d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
@@ -1699,8 +1699,7 @@ static int __devinit gsc_probe(struct platform_device *pdev)
 	ctx->gsc_clk = clk_get(dev, "gscl");
 	if (IS_ERR(ctx->gsc_clk)) {
 		dev_err(dev, "failed to get gsc clock.\n");
-		ret = PTR_ERR(ctx->gsc_clk);
-		goto err_ctx;
+		return PTR_ERR(ctx->gsc_clk);
 	}
 
 	/* resource memory */
@@ -1723,7 +1722,7 @@ static int __devinit gsc_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;
@@ -1731,7 +1730,7 @@ static int __devinit gsc_probe(struct platform_device *pdev)
 		IRQF_ONESHOT, "drm_gsc", ctx);
 	if (ret < 0) {
 		dev_err(dev, "failed to request irq.\n");
-		goto err_get_regs;
+		goto err_clk;
 	}
 
 	/* context initailization */
@@ -1775,12 +1774,8 @@ 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->gsc_clk);
-err_ctx:
-	devm_kfree(dev, ctx);
 	return ret;
 }
 
@@ -1798,12 +1793,8 @@ static int __devexit gsc_remove(struct platform_device *pdev)
 	pm_runtime_disable(dev);
 
 	free_irq(ctx->irq, ctx);
-	devm_iounmap(dev, ctx->regs);
-
 	clk_put(ctx->gsc_clk);
 
-	devm_kfree(dev, ctx);
-
 	return 0;
 }
 
-- 
1.7.4.1



More information about the dri-devel mailing list