* [PATCH] cpufreq: cpu0: drop wrong devm usage
@ 2014-05-16 10:20 Lucas Stach
2014-05-16 11:24 ` Viresh Kumar
0 siblings, 1 reply; 4+ messages in thread
From: Lucas Stach @ 2014-05-16 10:20 UTC (permalink / raw)
To: cpufreq; +Cc: Rafael J. Wysocki, Viresh Kumar, kernel
This driver is using devres managed calls incorrectly, giving the cpu0
device as first parameter instead of the cpufreq platform device.
This results in resources not being freed if the cpufreq platform device
is unbound, for example if probing has to be deferred for a missing
regulator.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
drivers/cpufreq/cpufreq-cpu0.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index 1bf6bbac3e03..09b9129c7bd3 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -130,7 +130,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
return -ENOENT;
}
- cpu_reg = devm_regulator_get_optional(cpu_dev, "cpu0");
+ cpu_reg = regulator_get_optional(cpu_dev, "cpu0");
if (IS_ERR(cpu_reg)) {
/*
* If cpu0 regulator supply node is present, but regulator is
@@ -145,23 +145,23 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
PTR_ERR(cpu_reg));
}
- cpu_clk = devm_clk_get(cpu_dev, NULL);
+ cpu_clk = clk_get(cpu_dev, NULL);
if (IS_ERR(cpu_clk)) {
ret = PTR_ERR(cpu_clk);
pr_err("failed to get cpu0 clock: %d\n", ret);
- goto out_put_node;
+ goto out_put_reg;
}
ret = of_init_opp_table(cpu_dev);
if (ret) {
pr_err("failed to init OPP table: %d\n", ret);
- goto out_put_node;
+ goto out_put_clk;
}
ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table);
if (ret) {
pr_err("failed to init cpufreq table: %d\n", ret);
- goto out_put_node;
+ goto out_put_clk;
}
of_property_read_u32(np, "voltage-tolerance", &voltage_tolerance);
@@ -216,6 +216,12 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
out_free_table:
dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);
+out_put_clk:
+ if (!IS_ERR(cpu_clk))
+ clk_put(cpu_clk);
+out_put_reg:
+ if (!IS_ERR(cpu_reg))
+ regulator_put(cpu_reg);
out_put_node:
of_node_put(np);
return ret;
--
2.0.0.rc0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] cpufreq: cpu0: drop wrong devm usage
2014-05-16 10:20 [PATCH] cpufreq: cpu0: drop wrong devm usage Lucas Stach
@ 2014-05-16 11:24 ` Viresh Kumar
2014-05-16 23:03 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Viresh Kumar @ 2014-05-16 11:24 UTC (permalink / raw)
To: Lucas Stach; +Cc: cpufreq@vger.kernel.org, Rafael J. Wysocki, Sascha Hauer
On 16 May 2014 15:50, Lucas Stach <l.stach@pengutronix.de> wrote:
> This driver is using devres managed calls incorrectly, giving the cpu0
> device as first parameter instead of the cpufreq platform device.
> This results in resources not being freed if the cpufreq platform device
> is unbound, for example if probing has to be deferred for a missing
> regulator.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> drivers/cpufreq/cpufreq-cpu0.c | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cpufreq: cpu0: drop wrong devm usage
2014-05-16 11:24 ` Viresh Kumar
@ 2014-05-16 23:03 ` Rafael J. Wysocki
2014-05-17 4:59 ` Viresh Kumar
0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2014-05-16 23:03 UTC (permalink / raw)
To: Viresh Kumar; +Cc: Lucas Stach, cpufreq@vger.kernel.org, Sascha Hauer
On Friday, May 16, 2014 04:54:27 PM Viresh Kumar wrote:
> On 16 May 2014 15:50, Lucas Stach <l.stach@pengutronix.de> wrote:
> > This driver is using devres managed calls incorrectly, giving the cpu0
> > device as first parameter instead of the cpufreq platform device.
> > This results in resources not being freed if the cpufreq platform device
> > is unbound, for example if probing has to be deferred for a missing
> > regulator.
> >
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > ---
> > drivers/cpufreq/cpufreq-cpu0.c | 16 +++++++++++-----
> > 1 file changed, 11 insertions(+), 5 deletions(-)
>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Is this -stable material? If so, which -stable?
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cpufreq: cpu0: drop wrong devm usage
2014-05-16 23:03 ` Rafael J. Wysocki
@ 2014-05-17 4:59 ` Viresh Kumar
0 siblings, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2014-05-17 4:59 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Lucas Stach, cpufreq@vger.kernel.org, Sascha Hauer
On 17 May 2014 04:33, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> Is this -stable material? If so, which -stable?
3.9+
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-05-17 4:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-16 10:20 [PATCH] cpufreq: cpu0: drop wrong devm usage Lucas Stach
2014-05-16 11:24 ` Viresh Kumar
2014-05-16 23:03 ` Rafael J. Wysocki
2014-05-17 4:59 ` Viresh Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).