2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-03 11:13:56 +08:00

cpufreq-dt: free OPP table created during ->init()

OPP layer now supports freeing of OPPs and we should free them once they aren't
useful anymore.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Viresh Kumar 2014-11-25 16:04:21 +05:30 committed by Rafael J. Wysocki
parent 2af3411f0e
commit 2f0f609f2e

View File

@ -214,7 +214,7 @@ static int cpufreq_init(struct cpufreq_policy *policy)
priv = kzalloc(sizeof(*priv), GFP_KERNEL); priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) { if (!priv) {
ret = -ENOMEM; ret = -ENOMEM;
goto out_put_node; goto out_free_opp;
} }
of_property_read_u32(np, "voltage-tolerance", &priv->voltage_tolerance); of_property_read_u32(np, "voltage-tolerance", &priv->voltage_tolerance);
@ -294,7 +294,8 @@ out_free_cpufreq_table:
dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);
out_free_priv: out_free_priv:
kfree(priv); kfree(priv);
out_put_node: out_free_opp:
of_free_opp_table(cpu_dev);
of_node_put(np); of_node_put(np);
out_put_reg_clk: out_put_reg_clk:
clk_put(cpu_clk); clk_put(cpu_clk);
@ -311,6 +312,7 @@ static int cpufreq_exit(struct cpufreq_policy *policy)
if (priv->cdev) if (priv->cdev)
cpufreq_cooling_unregister(priv->cdev); cpufreq_cooling_unregister(priv->cdev);
dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table);
of_free_opp_table(priv->cpu_dev);
clk_put(policy->clk); clk_put(policy->clk);
if (!IS_ERR(priv->cpu_reg)) if (!IS_ERR(priv->cpu_reg))
regulator_put(priv->cpu_reg); regulator_put(priv->cpu_reg);