Skip to content

Commit

Permalink
drm/exynos: Use devm_clk_get in exynos_drm_gsc.c
Browse files Browse the repository at this point in the history
This eliminates the need for explicit clk_put and makes the
cleanup and exit path code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
  • Loading branch information
Sachin Kamat authored and Inki Dae committed Jan 4, 2013
1 parent a8527cf commit 5cbd419
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions drivers/gpu/drm/exynos/exynos_drm_gsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,7 @@ static int __devinit gsc_probe(struct platform_device *pdev)
return -ENOMEM;

/* clock control */
ctx->gsc_clk = clk_get(dev, "gscl");
ctx->gsc_clk = devm_clk_get(dev, "gscl");
if (IS_ERR(ctx->gsc_clk)) {
dev_err(dev, "failed to get gsc clock.\n");
return PTR_ERR(ctx->gsc_clk);
Expand All @@ -1695,24 +1695,22 @@ static int __devinit gsc_probe(struct platform_device *pdev)
ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res);
if (!ctx->regs) {
dev_err(dev, "failed to map registers.\n");
ret = -ENXIO;
goto err_clk;
return -ENXIO;
}

/* resource irq */
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) {
dev_err(dev, "failed to request irq resource.\n");
ret = -ENOENT;
goto err_clk;
return -ENOENT;
}

ctx->irq = res->start;
ret = request_threaded_irq(ctx->irq, NULL, gsc_irq_handler,
IRQF_ONESHOT, "drm_gsc", ctx);
if (ret < 0) {
dev_err(dev, "failed to request irq.\n");
goto err_clk;
return ret;
}

/* context initailization */
Expand Down Expand Up @@ -1756,8 +1754,6 @@ static int __devinit gsc_probe(struct platform_device *pdev)
pm_runtime_disable(dev);
err_get_irq:
free_irq(ctx->irq, ctx);
err_clk:
clk_put(ctx->gsc_clk);
return ret;
}

Expand All @@ -1775,7 +1771,6 @@ static int __devexit gsc_remove(struct platform_device *pdev)
pm_runtime_disable(dev);

free_irq(ctx->irq, ctx);
clk_put(ctx->gsc_clk);

return 0;
}
Expand Down

0 comments on commit 5cbd419

Please sign in to comment.