* [PATCH 0/3] PCI: dra7xx: fix resource leaks in probe error paths
@ 2026-08-22 15:07 Felix Gu
2026-08-22 15:07 ` [PATCH 1/3] PCI: dra7xx: Fix clock enable leak on probe failure Felix Gu
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Felix Gu @ 2026-08-22 15:07 UTC (permalink / raw)
To: Vignesh Raghavendra, Siddharth Vadapalli, Lorenzo Pieralisi,
Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
Bjorn Helgaas, Kishon Vijay Abraham I, Luca Ceresoli, Sekhar Nori
Cc: linux-omap, linux-pci, linux-arm-kernel, linux-kernel, Felix Gu
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
Felix Gu (3):
PCI: dra7xx: Fix clock enable leak on probe failure
PCI: dra7xx: Fix device link leak when devm_phy_get() fails
PCI: dra7xx: Fix device links leak when dra7xx_pcie_enable_phy() fails
drivers/pci/controller/dwc/pci-dra7xx.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
---
base-commit: 903c1cf6dff9964e71eda98a39e2e5d442050472
change-id: 20260822-dra7xx-39925beb4219
Best regards,
--
Felix Gu <ustc.gu@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] PCI: dra7xx: Fix clock enable leak on probe failure
2026-08-22 15:07 [PATCH 0/3] PCI: dra7xx: fix resource leaks in probe error paths Felix Gu
@ 2026-08-22 15:07 ` Felix Gu
2026-08-22 15:07 ` [PATCH 2/3] PCI: dra7xx: Fix device link leak when devm_phy_get() fails Felix Gu
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Felix Gu @ 2026-08-22 15:07 UTC (permalink / raw)
To: Vignesh Raghavendra, Siddharth Vadapalli, Lorenzo Pieralisi,
Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
Bjorn Helgaas, Kishon Vijay Abraham I, Luca Ceresoli, Sekhar Nori
Cc: linux-omap, linux-pci, linux-arm-kernel, linux-kernel, Felix Gu
dra7xx_pcie_probe() enables the optional clock but never disables it
when probing fails afterwards.
Switch to devm_clk_get_optional_enabled(), which disables the clock
automatically on failure.
Fixes: 5af9405397bf ("PCI: dra7xx: Get an optional clock")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
drivers/pci/controller/dwc/pci-dra7xx.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
index 6ae5b27e27b3..d43253f7dea6 100644
--- a/drivers/pci/controller/dwc/pci-dra7xx.c
+++ b/drivers/pci/controller/dwc/pci-dra7xx.c
@@ -732,15 +732,11 @@ static int dra7xx_pcie_probe(struct platform_device *pdev)
if (!link)
return -ENOMEM;
- dra7xx->clk = devm_clk_get_optional(dev, NULL);
+ dra7xx->clk = devm_clk_get_optional_enabled(dev, NULL);
if (IS_ERR(dra7xx->clk))
return dev_err_probe(dev, PTR_ERR(dra7xx->clk),
"clock request failed");
- ret = clk_prepare_enable(dra7xx->clk);
- if (ret)
- return ret;
-
for (i = 0; i < phy_count; i++) {
snprintf(name, sizeof(name), "pcie-phy%d", i);
phy[i] = devm_phy_get(dev, name);
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] PCI: dra7xx: Fix device link leak when devm_phy_get() fails
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:07 ` Felix Gu
2026-08-22 15:07 ` [PATCH 3/3] PCI: dra7xx: Fix device links leak when dra7xx_pcie_enable_phy() fails Felix Gu
2026-08-25 10:47 ` [PATCH 0/3] PCI: dra7xx: fix resource leaks in probe error paths Luca Ceresoli
3 siblings, 0 replies; 5+ messages in thread
From: Felix Gu @ 2026-08-22 15:07 UTC (permalink / raw)
To: Vignesh Raghavendra, Siddharth Vadapalli, Lorenzo Pieralisi,
Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
Bjorn Helgaas, Kishon Vijay Abraham I, Luca Ceresoli, Sekhar Nori
Cc: linux-omap, linux-pci, linux-arm-kernel, linux-kernel, Felix Gu
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] PCI: dra7xx: Fix device links leak when dra7xx_pcie_enable_phy() fails
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:07 ` [PATCH 2/3] PCI: dra7xx: Fix device link leak when devm_phy_get() fails Felix Gu
@ 2026-08-22 15:07 ` Felix Gu
2026-08-25 10:47 ` [PATCH 0/3] PCI: dra7xx: fix resource leaks in probe error paths Luca Ceresoli
3 siblings, 0 replies; 5+ messages in thread
From: Felix Gu @ 2026-08-22 15:07 UTC (permalink / raw)
To: Vignesh Raghavendra, Siddharth Vadapalli, Lorenzo Pieralisi,
Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
Bjorn Helgaas, Kishon Vijay Abraham I, Luca Ceresoli, Sekhar Nori
Cc: linux-omap, linux-pci, linux-arm-kernel, linux-kernel, Felix Gu
When dra7xx_pcie_enable_phy() 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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
index bf32b14436f9..5bd9d1df80ad 100644
--- a/drivers/pci/controller/dwc/pci-dra7xx.c
+++ b/drivers/pci/controller/dwc/pci-dra7xx.c
@@ -766,7 +766,7 @@ static int dra7xx_pcie_probe(struct platform_device *pdev)
ret = dra7xx_pcie_enable_phy(dra7xx);
if (ret) {
dev_err(dev, "failed to enable phy\n");
- return ret;
+ goto err_link;
}
platform_set_drvdata(pdev, dra7xx);
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] PCI: dra7xx: fix resource leaks in probe error paths
2026-08-22 15:07 [PATCH 0/3] PCI: dra7xx: fix resource leaks in probe error paths Felix Gu
` (2 preceding siblings ...)
2026-08-22 15:07 ` [PATCH 3/3] PCI: dra7xx: Fix device links leak when dra7xx_pcie_enable_phy() fails Felix Gu
@ 2026-08-25 10:47 ` Luca Ceresoli
3 siblings, 0 replies; 5+ messages in thread
From: Luca Ceresoli @ 2026-08-25 10:47 UTC (permalink / raw)
To: Felix Gu, Vignesh Raghavendra, Siddharth Vadapalli,
Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas,
Kishon Vijay Abraham I, Luca Ceresoli, Sekhar Nori
Cc: linux-omap, linux-pci, linux-arm-kernel, linux-kernel
On Sat Aug 22, 2026 at 5:07 PM CEST, Felix Gu wrote:
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
All series:
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-25 10:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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:07 ` [PATCH 2/3] PCI: dra7xx: Fix device link leak when devm_phy_get() fails Felix Gu
2026-08-22 15:07 ` [PATCH 3/3] PCI: dra7xx: Fix device links leak when dra7xx_pcie_enable_phy() fails Felix Gu
2026-08-25 10:47 ` [PATCH 0/3] PCI: dra7xx: fix resource leaks in probe error paths Luca Ceresoli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox