linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM: AVS: qcom-cpr: Fix an error handling path in cpr_probe()
@ 2022-12-17 16:05 Christophe JAILLET
  2023-01-02 15:12 ` Ulf Hansson
  2023-01-10 16:17 ` Bjorn Andersson
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-12-17 16:05 UTC (permalink / raw)
  To: Niklas Cassel, Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Jorge Ramirez-Ortiz, Ulf Hansson, Rafael J. Wysocki
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, Niklas Cassel,
	linux-pm, linux-arm-msm

If an error occurs after a successful pm_genpd_init() call, it should be
undone by a corresponding pm_genpd_remove().

Add the missing call in the error handling path, as already done in the
remove function.

Fixes: bf6910abf548 ("power: avs: Add support for CPR (Core Power Reduction)")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/soc/qcom/cpr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/cpr.c b/drivers/soc/qcom/cpr.c
index e9b854ed1bdf..144ea68e0920 100644
--- a/drivers/soc/qcom/cpr.c
+++ b/drivers/soc/qcom/cpr.c
@@ -1708,12 +1708,16 @@ static int cpr_probe(struct platform_device *pdev)
 
 	ret = of_genpd_add_provider_simple(dev->of_node, &drv->pd);
 	if (ret)
-		return ret;
+		goto err_remove_genpd;
 
 	platform_set_drvdata(pdev, drv);
 	cpr_debugfs_init(drv);
 
 	return 0;
+
+err_remove_genpd:
+	pm_genpd_remove(&drv->pd);
+	return ret;
 }
 
 static int cpr_remove(struct platform_device *pdev)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] PM: AVS: qcom-cpr: Fix an error handling path in cpr_probe()
  2022-12-17 16:05 [PATCH] PM: AVS: qcom-cpr: Fix an error handling path in cpr_probe() Christophe JAILLET
@ 2023-01-02 15:12 ` Ulf Hansson
  2023-01-10 16:17 ` Bjorn Andersson
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2023-01-02 15:12 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Niklas Cassel, Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Jorge Ramirez-Ortiz, Rafael J. Wysocki, linux-kernel,
	kernel-janitors, Niklas Cassel, linux-pm, linux-arm-msm

On Sat, 17 Dec 2022 at 17:05, Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> If an error occurs after a successful pm_genpd_init() call, it should be
> undone by a corresponding pm_genpd_remove().
>
> Add the missing call in the error handling path, as already done in the
> remove function.
>
> Fixes: bf6910abf548 ("power: avs: Add support for CPR (Core Power Reduction)")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
>  drivers/soc/qcom/cpr.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/soc/qcom/cpr.c b/drivers/soc/qcom/cpr.c
> index e9b854ed1bdf..144ea68e0920 100644
> --- a/drivers/soc/qcom/cpr.c
> +++ b/drivers/soc/qcom/cpr.c
> @@ -1708,12 +1708,16 @@ static int cpr_probe(struct platform_device *pdev)
>
>         ret = of_genpd_add_provider_simple(dev->of_node, &drv->pd);
>         if (ret)
> -               return ret;
> +               goto err_remove_genpd;
>
>         platform_set_drvdata(pdev, drv);
>         cpr_debugfs_init(drv);
>
>         return 0;
> +
> +err_remove_genpd:
> +       pm_genpd_remove(&drv->pd);
> +       return ret;
>  }
>
>  static int cpr_remove(struct platform_device *pdev)
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PM: AVS: qcom-cpr: Fix an error handling path in cpr_probe()
  2022-12-17 16:05 [PATCH] PM: AVS: qcom-cpr: Fix an error handling path in cpr_probe() Christophe JAILLET
  2023-01-02 15:12 ` Ulf Hansson
@ 2023-01-10 16:17 ` Bjorn Andersson
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2023-01-10 16:17 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, ulf.hansson, christophe.jaillet, nks,
	rafael.j.wysocki, agross, konrad.dybcio
  Cc: linux-kernel, linux-pm, niklas.cassel, kernel-janitors, linux-arm-msm

On Sat, 17 Dec 2022 17:05:41 +0100, Christophe JAILLET wrote:
> If an error occurs after a successful pm_genpd_init() call, it should be
> undone by a corresponding pm_genpd_remove().
> 
> Add the missing call in the error handling path, as already done in the
> remove function.
> 
> 
> [...]

Applied, thanks!

[1/1] PM: AVS: qcom-cpr: Fix an error handling path in cpr_probe()
      commit: 6049aae52392539e505bfb8ccbcff3c26f1d2f0b

Best regards,
-- 
Bjorn Andersson <andersson@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-10 16:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-17 16:05 [PATCH] PM: AVS: qcom-cpr: Fix an error handling path in cpr_probe() Christophe JAILLET
2023-01-02 15:12 ` Ulf Hansson
2023-01-10 16:17 ` Bjorn Andersson

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).