From: Felix Gu <ustc.gu@gmail.com>
To: "Vignesh Raghavendra" <vigneshr@ti.com>,
"Siddharth Vadapalli" <s-vadapalli@ti.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Luca Ceresoli" <luca.ceresoli@bootlin.com>,
"Sekhar Nori" <nsekhar@ti.com>
Cc: linux-omap@vger.kernel.org, linux-pci@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Felix Gu <ustc.gu@gmail.com>
Subject: [PATCH 2/3] PCI: dra7xx: Fix device link leak when devm_phy_get() fails
Date: Sat, 22 Aug 2026 23:07:48 +0800 [thread overview]
Message-ID: <20260822-dra7xx-v1-2-23e204d5548b@gmail.com> (raw)
In-Reply-To: <20260822-dra7xx-v1-0-23e204d5548b@gmail.com>
When devm_phy_get() fails, the code returned immediately and left the
already created device links behind.
Jump to the existing err_link cleanup instead so those links are
deleted on failure.
Fixes: 7a4db656a635 ("PCI: dra7xx: Create functional dependency between PCIe and PHY")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
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 d43253f7dea6..bf32b14436f9 100644
--- a/drivers/pci/controller/dwc/pci-dra7xx.c
+++ b/drivers/pci/controller/dwc/pci-dra7xx.c
@@ -740,8 +740,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.43.0
next prev parent reply other threads:[~2026-08-22 15:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-22 15:07 [PATCH 0/3] PCI: dra7xx: fix resource leaks in probe error paths Felix Gu
2026-08-22 15:07 ` [PATCH 1/3] PCI: dra7xx: Fix clock enable leak on probe failure Felix Gu
2026-08-22 15:20 ` sashiko-bot
2026-08-22 15:07 ` Felix Gu [this message]
2026-08-22 15:17 ` [PATCH 2/3] PCI: dra7xx: Fix device link leak when devm_phy_get() fails sashiko-bot
2026-08-22 15:07 ` [PATCH 3/3] PCI: dra7xx: Fix device links leak when dra7xx_pcie_enable_phy() fails Felix Gu
2026-08-22 15:20 ` sashiko-bot
2026-08-25 10:47 ` [PATCH 0/3] PCI: dra7xx: fix resource leaks in probe error paths Luca Ceresoli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260822-dra7xx-v1-2-23e204d5548b@gmail.com \
--to=ustc.gu@gmail.com \
--cc=bhelgaas@google.com \
--cc=kishon@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=mani@kernel.org \
--cc=nsekhar@ti.com \
--cc=robh@kernel.org \
--cc=s-vadapalli@ti.com \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox