public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] PCI: stm32: Re-use existing error handling path in stm32_pcie_probe()
@ 2025-09-29 18:19 Christophe JAILLET
  2025-10-01  8:32 ` Christian Bruel
  2025-10-01 14:52 ` Bjorn Helgaas
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2025-09-29 18:19 UTC (permalink / raw)
  To: Christian Bruel, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas,
	Maxime Coquelin, Alexandre Torgue
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-pci,
	linux-stm32, linux-arm-kernel

An error handling path is already available, so use it instead of hand
writing the same code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/pci/controller/dwc/pcie-stm32.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-stm32.c b/drivers/pci/controller/dwc/pcie-stm32.c
index 964fa6f674c8..96a5fb893af4 100644
--- a/drivers/pci/controller/dwc/pcie-stm32.c
+++ b/drivers/pci/controller/dwc/pcie-stm32.c
@@ -287,18 +287,16 @@ static int stm32_pcie_probe(struct platform_device *pdev)
 
 	ret = pm_runtime_set_active(dev);
 	if (ret < 0) {
-		clk_disable_unprepare(stm32_pcie->clk);
-		stm32_remove_pcie_port(stm32_pcie);
-		return dev_err_probe(dev, ret, "Failed to activate runtime PM\n");
+		dev_err_probe(dev, ret, "Failed to activate runtime PM\n");
+		goto err_disable_clk;
 	}
 
 	pm_runtime_no_callbacks(dev);
 
 	ret = devm_pm_runtime_enable(dev);
 	if (ret < 0) {
-		clk_disable_unprepare(stm32_pcie->clk);
-		stm32_remove_pcie_port(stm32_pcie);
-		return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
+		dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
+		goto err_disable_clk;
 	}
 
 	ret = dw_pcie_host_init(&stm32_pcie->pci.pp);
-- 
2.51.0



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

* Re: [PATCH] PCI: stm32: Re-use existing error handling path in stm32_pcie_probe()
  2025-09-29 18:19 [PATCH] PCI: stm32: Re-use existing error handling path in stm32_pcie_probe() Christophe JAILLET
@ 2025-10-01  8:32 ` Christian Bruel
  2025-10-01 14:52 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Bruel @ 2025-10-01  8:32 UTC (permalink / raw)
  To: Christophe JAILLET, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas,
	Maxime Coquelin, Alexandre Torgue
  Cc: linux-kernel, kernel-janitors, linux-pci, linux-stm32,
	linux-arm-kernel, Dan Carpenter

Hi Christophe,

On 9/29/25 20:19, Christophe JAILLET wrote:
> An error handling path is already available, so use it instead of hand
> writing the same code.

This fix is pending:

https://lore.kernel.org/linux-pci/0b8b8cde-d273-442c-8537-3fa95885476b@foss.st.com/

Bjorn, Manivannan, gentle ping

thank you

Christian

> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>   drivers/pci/controller/dwc/pcie-stm32.c | 10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-stm32.c b/drivers/pci/controller/dwc/pcie-stm32.c
> index 964fa6f674c8..96a5fb893af4 100644
> --- a/drivers/pci/controller/dwc/pcie-stm32.c
> +++ b/drivers/pci/controller/dwc/pcie-stm32.c
> @@ -287,18 +287,16 @@ static int stm32_pcie_probe(struct platform_device *pdev)
>   
>   	ret = pm_runtime_set_active(dev);
>   	if (ret < 0) {
> -		clk_disable_unprepare(stm32_pcie->clk);
> -		stm32_remove_pcie_port(stm32_pcie);
> -		return dev_err_probe(dev, ret, "Failed to activate runtime PM\n");
> +		dev_err_probe(dev, ret, "Failed to activate runtime PM\n");
> +		goto err_disable_clk;
>   	}
>   
>   	pm_runtime_no_callbacks(dev);
>   
>   	ret = devm_pm_runtime_enable(dev);
>   	if (ret < 0) {
> -		clk_disable_unprepare(stm32_pcie->clk);
> -		stm32_remove_pcie_port(stm32_pcie);
> -		return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
> +		dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
> +		goto err_disable_clk;
>   	}
>   
>   	ret = dw_pcie_host_init(&stm32_pcie->pci.pp);



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

* Re: [PATCH] PCI: stm32: Re-use existing error handling path in stm32_pcie_probe()
  2025-09-29 18:19 [PATCH] PCI: stm32: Re-use existing error handling path in stm32_pcie_probe() Christophe JAILLET
  2025-10-01  8:32 ` Christian Bruel
@ 2025-10-01 14:52 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2025-10-01 14:52 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Christian Bruel, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas,
	Maxime Coquelin, Alexandre Torgue, linux-kernel, kernel-janitors,
	linux-pci, linux-stm32, linux-arm-kernel

On Mon, Sep 29, 2025 at 08:19:30PM +0200, Christophe JAILLET wrote:
> An error handling path is already available, so use it instead of hand
> writing the same code.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

The stm32 driver hasn't been merged upstream yet, so I squashed this
into it:

  https://git.kernel.org/cgit/linux/kernel/git/pci/pci.git/commit/?id=fd486e67e88c

Thank you!

> ---
>  drivers/pci/controller/dwc/pcie-stm32.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-stm32.c b/drivers/pci/controller/dwc/pcie-stm32.c
> index 964fa6f674c8..96a5fb893af4 100644
> --- a/drivers/pci/controller/dwc/pcie-stm32.c
> +++ b/drivers/pci/controller/dwc/pcie-stm32.c
> @@ -287,18 +287,16 @@ static int stm32_pcie_probe(struct platform_device *pdev)
>  
>  	ret = pm_runtime_set_active(dev);
>  	if (ret < 0) {
> -		clk_disable_unprepare(stm32_pcie->clk);
> -		stm32_remove_pcie_port(stm32_pcie);
> -		return dev_err_probe(dev, ret, "Failed to activate runtime PM\n");
> +		dev_err_probe(dev, ret, "Failed to activate runtime PM\n");
> +		goto err_disable_clk;
>  	}
>  
>  	pm_runtime_no_callbacks(dev);
>  
>  	ret = devm_pm_runtime_enable(dev);
>  	if (ret < 0) {
> -		clk_disable_unprepare(stm32_pcie->clk);
> -		stm32_remove_pcie_port(stm32_pcie);
> -		return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
> +		dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
> +		goto err_disable_clk;
>  	}
>  
>  	ret = dw_pcie_host_init(&stm32_pcie->pci.pp);
> -- 
> 2.51.0
> 
> 


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

end of thread, other threads:[~2025-10-01 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-29 18:19 [PATCH] PCI: stm32: Re-use existing error handling path in stm32_pcie_probe() Christophe JAILLET
2025-10-01  8:32 ` Christian Bruel
2025-10-01 14:52 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox