Skip to content

Commit 3f4590a

Browse files
gclementrafaeljw
authored andcommitted
cpufreq: mvebu: Free opp if registering failed
Since the introduction of this driver, the functions to remove the opp were added. So stop claiming we can't remove opp and use one of them in case of failure. Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent b337160 commit 3f4590a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

drivers/cpufreq/mvebu-cpufreq.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ static int __init armada_xp_pmsu_cpufreq_init(void)
7676
return PTR_ERR(clk);
7777
}
7878

79-
/*
80-
* In case of a failure of dev_pm_opp_add(), we don't
81-
* bother with cleaning up the registered OPP (there's
82-
* no function to do so), and simply cancel the
83-
* registration of the cpufreq device.
84-
*/
8579
ret = dev_pm_opp_add(cpu_dev, clk_get_rate(clk), 0);
8680
if (ret) {
8781
clk_put(clk);
@@ -91,7 +85,8 @@ static int __init armada_xp_pmsu_cpufreq_init(void)
9185
ret = dev_pm_opp_add(cpu_dev, clk_get_rate(clk) / 2, 0);
9286
if (ret) {
9387
clk_put(clk);
94-
return ret;
88+
dev_err(cpu_dev, "Failed to register OPPs\n");
89+
goto opp_register_failed;
9590
}
9691

9792
ret = dev_pm_opp_set_sharing_cpus(cpu_dev,
@@ -104,5 +99,11 @@ static int __init armada_xp_pmsu_cpufreq_init(void)
10499

105100
platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
106101
return 0;
102+
103+
opp_register_failed:
104+
/* As registering has failed remove all the opp for all cpus */
105+
dev_pm_opp_cpumask_remove_table(cpu_possible_mask);
106+
107+
return ret;
107108
}
108109
device_initcall(armada_xp_pmsu_cpufreq_init);

0 commit comments

Comments
 (0)