@@ -814,8 +814,6 @@ static void fimc_clk_put(struct fimc_dev *fimc)
if (IS_ERR_OR_NULL(fimc->clock[i]))
continue;
clk_unprepare(fimc->clock[i]);
- clk_put(fimc->clock[i]);
- fimc->clock[i] = NULL;
}
}
@@ -824,19 +822,15 @@ static int fimc_clk_get(struct fimc_dev *fimc)
int i, ret;
for (i = 0; i < MAX_FIMC_CLOCKS; i++) {
- fimc->clock[i] = clk_get(&fimc->pdev->dev, fimc_clocks[i]);
+ fimc->clock[i] = devm_clk_get(&fimc->pdev->dev, fimc_clocks[i]);
if (IS_ERR(fimc->clock[i]))
goto err;
ret = clk_prepare(fimc->clock[i]);
- if (ret < 0) {
- clk_put(fimc->clock[i]);
- fimc->clock[i] = NULL;
+ if (ret < 0)
goto err;
- }
}
return 0;
err:
- fimc_clk_put(fimc);
dev_err(&fimc->pdev->dev, "failed to get clock: %s\n",
fimc_clocks[i]);
return -ENXIO;
devm_clk_get is device managed and makes error handling and cleanup a bit simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> --- drivers/media/platform/s5p-fimc/fimc-core.c | 10 ++-------- 1 files changed, 2 insertions(+), 8 deletions(-)