phy: ti: omap-usb2: Fix device node reference leak in omap_usb2_probe
Subsystems (2)
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()")
Signed-off-by Miaoqian Lin <[email protected]>
--- drivers/phy/ti/phy-omap-usb2.c | 1 + 1 file changed, 1 insertion(+)
drivers/phy/ti/phy-omap-usb2.c +1 -0
@@ -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)
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
Signed-off-by Miaoqian Lin <[email protected]>
Other than that, looks good:
Reviewed-by Johan Hovold <[email protected]>
Johan