Switch to managed clk_get to properly release resources when
they are not needed.

Cc: "Rafael J. Wysocki" <r...@rjwysocki.net>
Cc: Viresh Kumar <viresh.ku...@linaro.org>
Cc: Kukjin Kim <kg...@kernel.org>
Cc: linux...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-samsung-...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubez...@gmail.com>
---
 drivers/cpufreq/exynos5250-cpufreq.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/drivers/cpufreq/exynos5250-cpufreq.c 
b/drivers/cpufreq/exynos5250-cpufreq.c
index e61d149..d3ce829 100644
--- a/drivers/cpufreq/exynos5250-cpufreq.c
+++ b/drivers/cpufreq/exynos5250-cpufreq.c
@@ -168,23 +168,23 @@ int exynos5250_cpufreq_init(struct exynos_dvfs_info *info)
                return -EFAULT;
        }
 
-       cpu_clk = clk_get(NULL, "armclk");
+       cpu_clk = devm_clk_get(info->dev, "armclk");
        if (IS_ERR(cpu_clk))
-               return PTR_ERR(cpu_clk);
+               goto err;
 
-       moutcore = clk_get(NULL, "mout_cpu");
+       moutcore = devm_clk_get(info->dev, "mout_cpu");
        if (IS_ERR(moutcore))
-               goto err_moutcore;
+               goto err;
 
-       mout_mpll = clk_get(NULL, "mout_mpll");
+       mout_mpll = devm_clk_get(info->dev, "mout_mpll");
        if (IS_ERR(mout_mpll))
-               goto err_mout_mpll;
+               goto err;
 
        rate = clk_get_rate(mout_mpll) / 1000;
 
-       mout_apll = clk_get(NULL, "mout_apll");
+       mout_apll = devm_clk_get(info->dev, "mout_apll");
        if (IS_ERR(mout_apll))
-               goto err_mout_apll;
+               goto err;
 
        info->mpll_freq_khz = rate;
        /* 800Mhz */
@@ -199,13 +199,7 @@ int exynos5250_cpufreq_init(struct exynos_dvfs_info *info)
 
        return 0;
 
-err_mout_apll:
-       clk_put(mout_mpll);
-err_mout_mpll:
-       clk_put(moutcore);
-err_moutcore:
-       clk_put(cpu_clk);
-
+err:
        iounmap(info->cmu_regs);
        of_node_put(np);
        pr_err("%s: failed initialization\n", __func__);
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to