cpufreq: armada-37xx: Fix clock leak
authorGregory CLEMENT <gregory.clement@bootlin.com>
Wed, 4 Apr 2018 14:44:44 +0000 (16:44 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 10 Apr 2018 06:38:02 +0000 (08:38 +0200)
There was no clk_put() balancing the clk_get(). This commit fixes it.

Fixes: 92ce45fb875d (cpufreq: Add DVFS support for Armada 37xx)
Cc: 4.16+ <stable@vger.kernel.org> # 4.16+
Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/armada-37xx-cpufreq.c

index c6ebc88a7d8d93148dc3a94c281a5233a2b3501a..72a2975499dbaa605b84bea98cea24672d2d2c09 100644 (file)
@@ -202,6 +202,7 @@ static int __init armada37xx_cpufreq_driver_init(void)
        cur_frequency = clk_get_rate(clk);
        if (!cur_frequency) {
                dev_err(cpu_dev, "Failed to get clock rate for CPU\n");
+               clk_put(clk);
                return -EINVAL;
        }
 
@@ -210,6 +211,7 @@ static int __init armada37xx_cpufreq_driver_init(void)
                return -EINVAL;
 
        armada37xx_cpufreq_dvfs_setup(nb_pm_base, clk, dvfs->divider);
+       clk_put(clk);
 
        for (load_lvl = ARMADA_37XX_DVFS_LOAD_0; load_lvl < LOAD_LEVEL_NR;
             load_lvl++) {