]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
usb: cdns3: plat: fix leaked usb2_phy initialization on usb3_phy acquisition failure
authorPeter Chen <peter.chen@cixtech.com>
Wed, 13 May 2026 08:53:09 +0000 (16:53 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 May 2026 14:56:06 +0000 (16:56 +0200)
Move usb2_phy initialization after usb3_phy acquisition.

Fixes: f738957277ba ("usb: cdns3: Split core.c into cdns3-plat and core.c file")
Cc: stable <stable@kernel.org>
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/linux-devicetree/agKaEePSFknhDBg2@nchen-desktop/T/#m21e1d9c1574eb127ce03c0c2a1a49002ce435b52
Signed-off-by: Peter Chen <peter.chen@cixtech.com>
Link: https://patch.msgid.link/20260513085310.2217547-2-peter.chen@cixtech.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/cdns3/cdns3-plat.c

index 735df88774e43d892772c36d809e3bcf85f2a31c..d2e8d1e9007b54cfc9770ef059bc5a1589956729 100644 (file)
@@ -126,15 +126,15 @@ static int cdns3_plat_probe(struct platform_device *pdev)
                return dev_err_probe(dev, PTR_ERR(cdns->usb2_phy),
                                     "Failed to get cdn3,usb2-phy\n");
 
-       ret = phy_init(cdns->usb2_phy);
-       if (ret)
-               return ret;
-
        cdns->usb3_phy = devm_phy_optional_get(dev, "cdns3,usb3-phy");
        if (IS_ERR(cdns->usb3_phy))
                return dev_err_probe(dev, PTR_ERR(cdns->usb3_phy),
                                     "Failed to get cdn3,usb3-phy\n");
 
+       ret = phy_init(cdns->usb2_phy);
+       if (ret)
+               return ret;
+
        ret = phy_init(cdns->usb3_phy);
        if (ret)
                goto err_phy3_init;