aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-11-26 03:20:21 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-12-21 10:26:07 -0200
commite2732ae5dd9c765732dda6b7120eb74896562c22 (patch)
tree5471fa911c0a1d99c12af9c1d97790fa9322f0fc
parent21ae96d3973b926e89edf52bae560475105455ef (diff)
downloadlinux-e2732ae5dd9c765732dda6b7120eb74896562c22.tar.gz
[media] exynos-gsc: Use devm_clk_get()
devm_clk_get() is a device managed function and makes error handling a bit simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/platform/exynos-gsc/gsc-core.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
index c8b82c006bd..0c22ad57050 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1002,11 +1002,8 @@ static void *gsc_get_drv_data(struct platform_device *pdev)
static void gsc_clk_put(struct gsc_dev *gsc)
{
- if (!IS_ERR(gsc->clock)) {
+ if (!IS_ERR(gsc->clock))
clk_unprepare(gsc->clock);
- clk_put(gsc->clock);
- gsc->clock = NULL;
- }
}
static int gsc_clk_get(struct gsc_dev *gsc)
@@ -1015,28 +1012,22 @@ static int gsc_clk_get(struct gsc_dev *gsc)
dev_dbg(&gsc->pdev->dev, "gsc_clk_get Called\n");
- gsc->clock = clk_get(&gsc->pdev->dev, GSC_CLOCK_GATE_NAME);
+ gsc->clock = devm_clk_get(&gsc->pdev->dev, GSC_CLOCK_GATE_NAME);
if (IS_ERR(gsc->clock)) {
dev_err(&gsc->pdev->dev, "failed to get clock~~~: %s\n",
GSC_CLOCK_GATE_NAME);
- goto err_clk_get;
+ return PTR_ERR(gsc->clock);
}
ret = clk_prepare(gsc->clock);
if (ret < 0) {
dev_err(&gsc->pdev->dev, "clock prepare failed for clock: %s\n",
GSC_CLOCK_GATE_NAME);
- clk_put(gsc->clock);
gsc->clock = ERR_PTR(-EINVAL);
- goto err_clk_prepare;
+ return ret;
}
return 0;
-
-err_clk_prepare:
- gsc_clk_put(gsc);
-err_clk_get:
- return -ENXIO;
}
static int gsc_m2m_suspend(struct gsc_dev *gsc)