* [PATCH v2] cpufreq: imx6q: Fix the resource leak caused by incorrect error return
@ 2019-05-05 8:02 Jacky Bai
2019-05-07 5:53 ` Viresh Kumar
0 siblings, 1 reply; 4+ messages in thread
From: Jacky Bai @ 2019-05-05 8:02 UTC (permalink / raw)
To: festevam, shawnguo, viresh.kumar, rjw, s.hauer
Cc: linux-arm-kernel, dl-linux-imx, kernel, linux-pm
Previous goto only handled the node reference, the opp table,
regulator & clk resource also need to be free before error return.
Fixes: ddb64c5db3c (cpufreq: imx6q: fix possible object reference leak).
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
---
drivers/cpufreq/imx6q-cpufreq.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index 3e17560b1efe..1d4ecefaabc6 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -383,23 +383,22 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
goto put_reg;
}
+ /* Because we have added the OPPs here, we must free them */
+ free_opp = true;
+
if (of_machine_is_compatible("fsl,imx6ul") ||
of_machine_is_compatible("fsl,imx6ull")) {
ret = imx6ul_opp_check_speed_grading(cpu_dev);
if (ret) {
- if (ret == -EPROBE_DEFER)
- goto put_node;
-
- dev_err(cpu_dev, "failed to read ocotp: %d\n",
- ret);
- goto put_node;
+ if (ret != -EPROBE_DEFER)
+ dev_err(cpu_dev, "failed to read ocotp: %d\n",
+ ret);
+ goto out_free_opp;
}
} else {
imx6q_opp_check_speed_grading(cpu_dev);
}
- /* Because we have added the OPPs here, we must free them */
- free_opp = true;
num = dev_pm_opp_get_opp_count(cpu_dev);
if (num < 0) {
ret = num;
--
2.21.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] cpufreq: imx6q: Fix the resource leak caused by incorrect error return
2019-05-05 8:02 [PATCH v2] cpufreq: imx6q: Fix the resource leak caused by incorrect error return Jacky Bai
@ 2019-05-07 5:53 ` Viresh Kumar
2019-05-07 6:07 ` Uwe Kleine-König
0 siblings, 1 reply; 4+ messages in thread
From: Viresh Kumar @ 2019-05-07 5:53 UTC (permalink / raw)
To: Jacky Bai
Cc: linux-pm, festevam, s.hauer, rjw, dl-linux-imx, kernel, shawnguo,
linux-arm-kernel
On 05-05-19, 08:02, Jacky Bai wrote:
> Previous goto only handled the node reference, the opp table,
> regulator & clk resource also need to be free before error return.
>
> Fixes: ddb64c5db3c (cpufreq: imx6q: fix possible object reference leak).
This should have been.
Fixes: ddb64c5db3cc ("cpufreq: imx6q: fix possible object reference leak")
Auto configure it with following in .gitconfig
[pretty]
fixes = Fixes: %h (\"%s\")
onelin = commit %h (\"%s\")
and then:
git log --pretty=fixes ddb64c5db3c
will generate it by itself.
> Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
> ---
> drivers/cpufreq/imx6q-cpufreq.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
> index 3e17560b1efe..1d4ecefaabc6 100644
> --- a/drivers/cpufreq/imx6q-cpufreq.c
> +++ b/drivers/cpufreq/imx6q-cpufreq.c
> @@ -383,23 +383,22 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
> goto put_reg;
> }
>
> + /* Because we have added the OPPs here, we must free them */
> + free_opp = true;
> +
> if (of_machine_is_compatible("fsl,imx6ul") ||
> of_machine_is_compatible("fsl,imx6ull")) {
> ret = imx6ul_opp_check_speed_grading(cpu_dev);
> if (ret) {
> - if (ret == -EPROBE_DEFER)
> - goto put_node;
> -
> - dev_err(cpu_dev, "failed to read ocotp: %d\n",
> - ret);
> - goto put_node;
> + if (ret != -EPROBE_DEFER)
> + dev_err(cpu_dev, "failed to read ocotp: %d\n",
> + ret);
> + goto out_free_opp;
> }
> } else {
> imx6q_opp_check_speed_grading(cpu_dev);
> }
>
> - /* Because we have added the OPPs here, we must free them */
> - free_opp = true;
> num = dev_pm_opp_get_opp_count(cpu_dev);
> if (num < 0) {
> ret = num;
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
@Rafael: This needs to go in 5.2 itself, can you queue it directly ?
--
viresh
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] cpufreq: imx6q: Fix the resource leak caused by incorrect error return
2019-05-07 5:53 ` Viresh Kumar
@ 2019-05-07 6:07 ` Uwe Kleine-König
2019-05-07 6:14 ` Viresh Kumar
0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2019-05-07 6:07 UTC (permalink / raw)
To: Viresh Kumar
Cc: Jacky Bai, linux-pm, shawnguo, s.hauer, rjw, dl-linux-imx,
kernel, festevam, linux-arm-kernel
On Tue, May 07, 2019 at 11:23:27AM +0530, Viresh Kumar wrote:
> On 05-05-19, 08:02, Jacky Bai wrote:
> > Previous goto only handled the node reference, the opp table,
> > regulator & clk resource also need to be free before error return.
> >
> > Fixes: ddb64c5db3c (cpufreq: imx6q: fix possible object reference leak).
>
> This should have been.
>
> Fixes: ddb64c5db3cc ("cpufreq: imx6q: fix possible object reference leak")
>
> Auto configure it with following in .gitconfig
>
> [pretty]
> fixes = Fixes: %h (\"%s\")
> onelin = commit %h (\"%s\")
>
> and then:
>
> git log --pretty=fixes ddb64c5db3c
>
> will generate it by itself.
Just to add my color of the bikeshed, I have (among others):
[alias]
oneq = show -s --pretty='format:%h (\"%s\")'
in my ~/.gitconfig and can do:
$ git oneq ddb64c5db3c
ddb64c5db3cc ("cpufreq: imx6q: fix possible object reference leak")
which is a bit shorter than Viresh's suggestion.
(Originally I had "one" without the quotes which I learned (IIRC) from
the git mailing list. Instead of deviating from this I added 'q' for
"quotes" to match the usual convention in kernel land.)
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] cpufreq: imx6q: Fix the resource leak caused by incorrect error return
2019-05-07 6:07 ` Uwe Kleine-König
@ 2019-05-07 6:14 ` Viresh Kumar
0 siblings, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2019-05-07 6:14 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Jacky Bai, linux-pm, shawnguo, s.hauer, rjw, dl-linux-imx,
kernel, festevam, linux-arm-kernel
On 07-05-19, 08:07, Uwe Kleine-König wrote:
> Just to add my color of the bikeshed, I have (among others):
>
> [alias]
> oneq = show -s --pretty='format:%h (\"%s\")'
>
> in my ~/.gitconfig and can do:
>
> $ git oneq ddb64c5db3c
> ddb64c5db3cc ("cpufreq: imx6q: fix possible object reference leak")
>
> which is a bit shorter than Viresh's suggestion.
>
> (Originally I had "one" without the quotes which I learned (IIRC) from
> the git mailing list. Instead of deviating from this I added 'q' for
> "quotes" to match the usual convention in kernel land.)
I didn't tell that I also use some bash style aliases :)
$ alias glf
alias glf='git log --pretty=fixes'
and so all I do is:
glf ddb64c5db3c
Thanks Uwe.
--
viresh
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-07 6:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-05 8:02 [PATCH v2] cpufreq: imx6q: Fix the resource leak caused by incorrect error return Jacky Bai
2019-05-07 5:53 ` Viresh Kumar
2019-05-07 6:07 ` Uwe Kleine-König
2019-05-07 6:14 ` 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).