mvebu: add fix for armada 37xx cpufreq driver
[openwrt/staging/xback.git] / target / linux / mvebu / patches-4.14 / 508-cpufreq-armada-37xx-Fix-clock-leak.patch
1 From bbcc328561040292f7d6796954d478e4a2335e6f Mon Sep 17 00:00:00 2001
2 From: Gregory CLEMENT <gregory.clement@bootlin.com>
3 Date: Wed, 4 Apr 2018 16:44:44 +0200
4 Subject: [PATCH] cpufreq: armada-37xx: Fix clock leak
5
6 There was no clk_put() balancing the clk_get(). This commit fixes it.
7
8 Fixes: 92ce45fb875d (cpufreq: Add DVFS support for Armada 37xx)
9 Cc: 4.16+ <stable@vger.kernel.org> # 4.16+
10 Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
11 Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
12 Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
13 Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
14 ---
15 drivers/cpufreq/armada-37xx-cpufreq.c | 2 ++
16 1 file changed, 2 insertions(+)
17
18 --- a/drivers/cpufreq/armada-37xx-cpufreq.c
19 +++ b/drivers/cpufreq/armada-37xx-cpufreq.c
20 @@ -202,6 +202,7 @@ static int __init armada37xx_cpufreq_dri
21 cur_frequency = clk_get_rate(clk);
22 if (!cur_frequency) {
23 dev_err(cpu_dev, "Failed to get clock rate for CPU\n");
24 + clk_put(clk);
25 return -EINVAL;
26 }
27
28 @@ -210,6 +211,7 @@ static int __init armada37xx_cpufreq_dri
29 return -EINVAL;
30
31 armada37xx_cpufreq_dvfs_setup(nb_pm_base, clk, dvfs->divider);
32 + clk_put(clk);
33
34 for (load_lvl = ARMADA_37XX_DVFS_LOAD_0; load_lvl < LOAD_LEVEL_NR;
35 load_lvl++) {