]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: ag71xx: call phylink_disconnect_phy if ag71xx_hw_enable() fail in ag71xx_open()
authorLiu Jian <liujian56@huawei.com>
Mon, 14 Nov 2022 09:55:49 +0000 (17:55 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Nov 2022 16:45:47 +0000 (17:45 +0100)
[ Upstream commit c9b895c6878bdb6789dc1d7af60fd10f4a9f1937 ]

If ag71xx_hw_enable() fails, call phylink_disconnect_phy() to clean up.
And if phylink_of_phy_connect() fails, nothing needs to be done.
Compile tested only.

Fixes: 892e09153fa3 ("net: ag71xx: port to phylink")
Signed-off-by: Liu Jian <liujian56@huawei.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/20221114095549.40342-1-liujian56@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/atheros/ag71xx.c

index c26c9b0c00d8fb7babd827ceb036bc10e8acb3c0..fe3ca3af431a4e055bc337d2e452dc72eb6aefde 100644 (file)
@@ -1468,7 +1468,7 @@ static int ag71xx_open(struct net_device *ndev)
        if (ret) {
                netif_err(ag, link, ndev, "phylink_of_phy_connect filed with err: %i\n",
                          ret);
-               goto err;
+               return ret;
        }
 
        max_frame_len = ag71xx_max_frame_len(ndev->mtu);
@@ -1489,6 +1489,7 @@ static int ag71xx_open(struct net_device *ndev)
 
 err:
        ag71xx_rings_cleanup(ag);
+       phylink_disconnect_phy(ag->phylink);
        return ret;
 }