linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] PCI: dra7xx: Added error handling in probe function when devm_phy_get() fails
@ 2024-10-01 10:57 Riyan Dhiman
  2024-10-02 20:35 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Riyan Dhiman @ 2024-10-01 10:57 UTC (permalink / raw)
  To: vigneshr, s-vadapalli, lpieralisi, kw, bhelgaas
  Cc: kishon, linux-omap, linux-pci, linux-arm-kernel, linux-kernel,
	Riyan Dhiman

While creation of device link, if devm_phy_get() function fails then it 
directly returns PTR_ERR without any cleanup of previous added device 
links.

Added goto statement to handle the cleanup of already added device links.

Fixes: 7a4db656a635 (PCI: dra7xx: Create functional dependency between 
PCIe and PHY)
Signed-off-by: Riyan Dhiman <riyandhiman14@gmail.com>
---
v2: resend when tree is open and reformat commit message

 drivers/pci/controller/dwc/pci-dra7xx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
index 4fe3b0cb72ec..c329d107b811 100644
--- a/drivers/pci/controller/dwc/pci-dra7xx.c
+++ b/drivers/pci/controller/dwc/pci-dra7xx.c
@@ -762,8 +762,10 @@ static int dra7xx_pcie_probe(struct platform_device *pdev)
 	for (i = 0; i < phy_count; i++) {
 		snprintf(name, sizeof(name), "pcie-phy%d", i);
 		phy[i] = devm_phy_get(dev, name);
-		if (IS_ERR(phy[i]))
-			return PTR_ERR(phy[i]);
+		if (IS_ERR(phy[i])) {
+			ret = PTR_ERR(phy[i]);
+			goto err_link;
+		}
 
 		link[i] = device_link_add(dev, &phy[i]->dev, DL_FLAG_STATELESS);
 		if (!link[i]) {
-- 
2.46.1


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

* Re: [PATCH v2] PCI: dra7xx: Added error handling in probe function when devm_phy_get() fails
  2024-10-01 10:57 [PATCH v2] PCI: dra7xx: Added error handling in probe function when devm_phy_get() fails Riyan Dhiman
@ 2024-10-02 20:35 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2024-10-02 20:35 UTC (permalink / raw)
  To: Riyan Dhiman
  Cc: vigneshr, s-vadapalli, lpieralisi, kw, bhelgaas, kishon,
	linux-omap, linux-pci, linux-arm-kernel, linux-kernel

On Tue, Oct 01, 2024 at 04:27:18PM +0530, Riyan Dhiman wrote:
> While creation of device link, if devm_phy_get() function fails then it 
> directly returns PTR_ERR without any cleanup of previous added device 
> links.
> 
> Added goto statement to handle the cleanup of already added device links.
> 
> Fixes: 7a4db656a635 (PCI: dra7xx: Create functional dependency between 
> PCIe and PHY)
> Signed-off-by: Riyan Dhiman <riyandhiman14@gmail.com>

No need to repost for this, but when applying, please
s/Added/Add/ in subject and commit log (I mentioned this before for
the v1 posting).

Also add statement in commit log about what the patch does (currently
it only says what the problem is).

And join Fixes: into a single line without a newline in the middle.

> ---
> v2: resend when tree is open and reformat commit message
> 
>  drivers/pci/controller/dwc/pci-dra7xx.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
> index 4fe3b0cb72ec..c329d107b811 100644
> --- a/drivers/pci/controller/dwc/pci-dra7xx.c
> +++ b/drivers/pci/controller/dwc/pci-dra7xx.c
> @@ -762,8 +762,10 @@ static int dra7xx_pcie_probe(struct platform_device *pdev)
>  	for (i = 0; i < phy_count; i++) {
>  		snprintf(name, sizeof(name), "pcie-phy%d", i);
>  		phy[i] = devm_phy_get(dev, name);
> -		if (IS_ERR(phy[i]))
> -			return PTR_ERR(phy[i]);
> +		if (IS_ERR(phy[i])) {
> +			ret = PTR_ERR(phy[i]);
> +			goto err_link;
> +		}
>  
>  		link[i] = device_link_add(dev, &phy[i]->dev, DL_FLAG_STATELESS);
>  		if (!link[i]) {
> -- 
> 2.46.1
> 

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

end of thread, other threads:[~2024-10-02 20:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-01 10:57 [PATCH v2] PCI: dra7xx: Added error handling in probe function when devm_phy_get() fails Riyan Dhiman
2024-10-02 20:35 ` Bjorn Helgaas

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