]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: phy: remove phy ports upon probe failure
authorMaxime Chevallier <maxime.chevallier@bootlin.com>
Thu, 4 Jun 2026 09:28:16 +0000 (11:28 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 9 Jun 2026 00:43:27 +0000 (17:43 -0700)
When phy_probe fails, let's clean the phy_ports that were successfully
added already.

Suggested-by: Nicolai Buchwitz <nb@tipi-net.de>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Fixes: 589e934d2735 ("net: phy: Introduce PHY ports representation")
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20260604092819.723505-3-maxime.chevallier@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/phy_device.c

index 6ccbfacf7d1d2e073493731abc670abcedb3d184..4ba8804468963415f7359526be46abe177085324 100644 (file)
@@ -3781,6 +3781,8 @@ out:
        sfp_bus_del_upstream(phydev->sfp_bus);
        phydev->sfp_bus = NULL;
 
+       phy_cleanup_ports(phydev);
+
        if (!phydev->is_on_sfp_module)
                phy_led_triggers_unregister(phydev);