Skip to contentSkip to conversation

phy: ti: omap-usb2: Fix device node reference leak in omap_usb2_probe

PATCH In review Miaoqian Lin 2 participants 2 messages Oct 28, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: ti: omap-usb2: Fix device node reference leak in omap_usb2_probe

In omap_usb2_probe(), of_parse_phandle() returns a device node with its reference count incremented. The caller is responsible for releasing this reference when the node is no longer needed.

Add of_node_put(control_node) after usage to fix the reference leak.

Found via static analysis.

Fixes 478b6c7436c2 ("usb: phy: omap-usb2: Don't use omap_get_control_dev()")
---
 drivers/phy/ti/phy-omap-usb2.c | 1 +
 1 file changed, 1 insertion(+)
drivers/phy/ti/phy-omap-usb2.c +1 -0
index 1eb252604441..660df3181e4f 100644
@@ -426,6 +426,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;
Signature · 1 line
2.39.5 (Apple Git-154)
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Miaoqian Lin

In omap_usb2_probe(), of_parse_phandle() returns a device node with its reference count incremented. The caller is responsible for releasing this reference when the node is no longer needed.

Add of_node_put(control_node) after usage to fix the reference leak.

Found via static analysis.

Fixes 478b6c7436c2 ("usb: phy: omap-usb2: Don't use omap_get_control_dev()")

There should not be any need to backport this one.

Quoted 1 line

Other than that, looks good:

Johan