]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usb: musb: omap2430: Do not put borrowed of_node in probe
authorGuangshuo Li <lgs201920130244@gmail.com>
Mon, 13 Jul 2026 11:47:11 +0000 (19:47 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Jul 2026 15:11:35 +0000 (17:11 +0200)
omap2430_probe() stores pdev->dev.of_node in a local np variable. This is
a borrowed pointer and the probe function does not take a reference to
it.

The success and error paths nevertheless call of_node_put(np). This drops
a reference that is owned by the platform device, and can leave
pdev->dev.of_node with an unbalanced reference count.

Do not put the borrowed platform device node from omap2430_probe().
References taken for the child MUSB device are handled by the device core,
and the ctrl-module phandle reference is still released separately.

Fixes: ffbe2feac59b ("usb: musb: omap2430: Fix probe regression for missing resources")
Cc: stable <stable@kernel.org>
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Link: https://patch.msgid.link/20260713114711.955253-1-lgs201920130244@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/musb/omap2430.c

index 333ab79f0ca90f3ce91c8c23dddf946efd204af2..6e749faac33cbffb3ee721ac147fe26304eb3ec5 100644 (file)
@@ -454,7 +454,6 @@ static int omap2430_probe(struct platform_device *pdev)
                dev_err(&pdev->dev, "failed to register musb device\n");
                goto err_disable_rpm;
        }
-       of_node_put(np);
 
        return 0;
 
@@ -464,7 +463,6 @@ err_put_control_otghs:
        if (!IS_ERR(glue->control_otghs))
                put_device(glue->control_otghs);
 err_put_musb:
-       of_node_put(np);
        platform_device_put(musb);
 
        return ret;