* [PATCH] cpufreq: tegra194: Fix an error handling path in tegra194_cpufreq_probe()
@ 2023-04-25 13:11 Christophe JAILLET
2023-04-28 11:34 ` Sumit Gupta
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Christophe JAILLET @ 2023-04-25 13:11 UTC (permalink / raw)
To: Rafael J. Wysocki, Viresh Kumar, Thierry Reding, Jonathan Hunter,
Sumit Gupta
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-pm,
linux-tegra
If the probe needs to be deferred, some resources still need to be
released. So branch to the error handling path instead of returning
directly.
Fixes: f41e1442ac5b ("cpufreq: tegra194: add OPP support and set bandwidth")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested-only
---
drivers/cpufreq/tegra194-cpufreq.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
index c8d03346068a..36dad5ea5947 100644
--- a/drivers/cpufreq/tegra194-cpufreq.c
+++ b/drivers/cpufreq/tegra194-cpufreq.c
@@ -686,8 +686,10 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
/* Check for optional OPPv2 and interconnect paths on CPU0 to enable ICC scaling */
cpu_dev = get_cpu_device(0);
- if (!cpu_dev)
- return -EPROBE_DEFER;
+ if (!cpu_dev) {
+ err = -EPROBE_DEFER;
+ goto err_free_res;
+ }
if (dev_pm_opp_of_get_opp_desc_node(cpu_dev)) {
err = dev_pm_opp_of_find_icc_paths(cpu_dev, NULL);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] cpufreq: tegra194: Fix an error handling path in tegra194_cpufreq_probe()
2023-04-25 13:11 [PATCH] cpufreq: tegra194: Fix an error handling path in tegra194_cpufreq_probe() Christophe JAILLET
@ 2023-04-28 11:34 ` Sumit Gupta
2023-05-02 10:30 ` Thierry Reding
2023-05-11 9:03 ` Viresh Kumar
2 siblings, 0 replies; 4+ messages in thread
From: Sumit Gupta @ 2023-04-28 11:34 UTC (permalink / raw)
To: Christophe JAILLET, Rafael J. Wysocki, Viresh Kumar,
Thierry Reding, Jonathan Hunter
Cc: linux-kernel, kernel-janitors, linux-pm, linux-tegra, Sumit Gupta
On 25/04/23 18:41, Christophe JAILLET wrote:
> External email: Use caution opening links or attachments
>
>
> If the probe needs to be deferred, some resources still need to be
> released. So branch to the error handling path instead of returning
> directly.
>
> Fixes: f41e1442ac5b ("cpufreq: tegra194: add OPP support and set bandwidth")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Sumit Gupta <sumitg@nvidia.com>
> ---
> Compile tested-only
> ---
> drivers/cpufreq/tegra194-cpufreq.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
> index c8d03346068a..36dad5ea5947 100644
> --- a/drivers/cpufreq/tegra194-cpufreq.c
> +++ b/drivers/cpufreq/tegra194-cpufreq.c
> @@ -686,8 +686,10 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
>
> /* Check for optional OPPv2 and interconnect paths on CPU0 to enable ICC scaling */
> cpu_dev = get_cpu_device(0);
> - if (!cpu_dev)
> - return -EPROBE_DEFER;
> + if (!cpu_dev) {
> + err = -EPROBE_DEFER;
> + goto err_free_res;
> + }
>
> if (dev_pm_opp_of_get_opp_desc_node(cpu_dev)) {
> err = dev_pm_opp_of_find_icc_paths(cpu_dev, NULL);
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cpufreq: tegra194: Fix an error handling path in tegra194_cpufreq_probe()
2023-04-25 13:11 [PATCH] cpufreq: tegra194: Fix an error handling path in tegra194_cpufreq_probe() Christophe JAILLET
2023-04-28 11:34 ` Sumit Gupta
@ 2023-05-02 10:30 ` Thierry Reding
2023-05-11 9:03 ` Viresh Kumar
2 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2023-05-02 10:30 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Rafael J. Wysocki, Viresh Kumar, Jonathan Hunter, Sumit Gupta,
linux-kernel, kernel-janitors, linux-pm, linux-tegra
[-- Attachment #1: Type: text/plain, Size: 1396 bytes --]
On Tue, Apr 25, 2023 at 03:11:19PM +0200, Christophe JAILLET wrote:
> If the probe needs to be deferred, some resources still need to be
> released. So branch to the error handling path instead of returning
> directly.
>
> Fixes: f41e1442ac5b ("cpufreq: tegra194: add OPP support and set bandwidth")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested-only
> ---
> drivers/cpufreq/tegra194-cpufreq.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
> index c8d03346068a..36dad5ea5947 100644
> --- a/drivers/cpufreq/tegra194-cpufreq.c
> +++ b/drivers/cpufreq/tegra194-cpufreq.c
> @@ -686,8 +686,10 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
>
> /* Check for optional OPPv2 and interconnect paths on CPU0 to enable ICC scaling */
> cpu_dev = get_cpu_device(0);
> - if (!cpu_dev)
> - return -EPROBE_DEFER;
> + if (!cpu_dev) {
> + err = -EPROBE_DEFER;
> + goto err_free_res;
> + }
I think ultimately it'd be better to try get_cpu_device(0) earlier so
that we don't do all that work upfront before we fail. However, it looks
like there's some other improvements that could be done in that area, so
this looks like a good fix in the meantime:
Acked-by: Thierry Reding <treding@nvidia.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cpufreq: tegra194: Fix an error handling path in tegra194_cpufreq_probe()
2023-04-25 13:11 [PATCH] cpufreq: tegra194: Fix an error handling path in tegra194_cpufreq_probe() Christophe JAILLET
2023-04-28 11:34 ` Sumit Gupta
2023-05-02 10:30 ` Thierry Reding
@ 2023-05-11 9:03 ` Viresh Kumar
2 siblings, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2023-05-11 9:03 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Rafael J. Wysocki, Thierry Reding, Jonathan Hunter, Sumit Gupta,
linux-kernel, kernel-janitors, linux-pm, linux-tegra
On 25-04-23, 15:11, Christophe JAILLET wrote:
> If the probe needs to be deferred, some resources still need to be
> released. So branch to the error handling path instead of returning
> directly.
>
> Fixes: f41e1442ac5b ("cpufreq: tegra194: add OPP support and set bandwidth")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested-only
> ---
> drivers/cpufreq/tegra194-cpufreq.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
> index c8d03346068a..36dad5ea5947 100644
> --- a/drivers/cpufreq/tegra194-cpufreq.c
> +++ b/drivers/cpufreq/tegra194-cpufreq.c
> @@ -686,8 +686,10 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
>
> /* Check for optional OPPv2 and interconnect paths on CPU0 to enable ICC scaling */
> cpu_dev = get_cpu_device(0);
> - if (!cpu_dev)
> - return -EPROBE_DEFER;
> + if (!cpu_dev) {
> + err = -EPROBE_DEFER;
> + goto err_free_res;
> + }
>
> if (dev_pm_opp_of_get_opp_desc_node(cpu_dev)) {
> err = dev_pm_opp_of_find_icc_paths(cpu_dev, NULL);
Applied. Thanks.
--
viresh
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-05-11 9:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-25 13:11 [PATCH] cpufreq: tegra194: Fix an error handling path in tegra194_cpufreq_probe() Christophe JAILLET
2023-04-28 11:34 ` Sumit Gupta
2023-05-02 10:30 ` Thierry Reding
2023-05-11 9:03 ` Viresh Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox