[PATCH] phy: ti: omap-usb2: fix OF node leak at probe

From
Zhao Feng <hidden>
Date
2026-11-09 07:24:53
Also in
lkml
omap_usb2_probe() obtains a reference to the ctrl-module device node
with of_parse_phandle() and never drops it, on either the successful
path or the !control_pdev error path.

Drop the node reference right after of_find_device_by_node(); the
device reference taken by of_find_device_by_node() keeps the platform
device alive and is released at unbind by the devm action registered
below.

Fixes: 478b6c7436c2 ("usb: phy: omap-usb2: Don't use omap_get_control_dev()")
Signed-off-by: Zhao Feng <redacted>
---
This is a resend of an identical one-line fix that stalled twice:

- Miaoqian Lin, 2025-10-28, with the same Fixes tag, which collected
  Reviewed-by: Johan Hovold [off-list ref] with the only remark
  that Cc: stable should be dropped (done here), but was never applied:
  https://marc.info/?l=linux-kernel&m=176163256031244
- Guangshuo Li, 2026-07-08, which got review feedback from Manivannan
  Sadhasivam on 2026-09-26 (wrong Fixes tag, cut-off commit message)
  and was never respun:
  https://marc.info/?l=linux-kernel&m=178349844443656

Verified against current upstream master, which still leaks the
reference.  Not runtime-tested (no OMAP hardware).

 drivers/phy/ti/phy-omap-usb2.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c
--- a/drivers/phy/ti/phy-omap-usb2.c
+++ b/drivers/phy/ti/phy-omap-usb2.c
@@ -427,6 +427,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
 
 		control_pdev = of_find_device_by_node(control_node);
+		of_node_put(control_node);
 		if (!control_pdev) {
 			dev_err(&pdev->dev, "Failed to get control device\n");
 			return -EINVAL;
 		}
-- 
2.39.2




-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help