Commit c9b895c6 authored by Liu Jian's avatar Liu Jian Committed by Jakub Kicinski

net: ag71xx: call phylink_disconnect_phy if ag71xx_hw_enable() fail in ag71xx_open()

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: 892e0915 ("net: ag71xx: port to phylink")
Signed-off-by: default avatarLiu Jian <liujian56@huawei.com>
Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/20221114095549.40342-1-liujian56@huawei.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 9d45921e
...@@ -1427,7 +1427,7 @@ static int ag71xx_open(struct net_device *ndev) ...@@ -1427,7 +1427,7 @@ static int ag71xx_open(struct net_device *ndev)
if (ret) { if (ret) {
netif_err(ag, link, ndev, "phylink_of_phy_connect filed with err: %i\n", netif_err(ag, link, ndev, "phylink_of_phy_connect filed with err: %i\n",
ret); ret);
goto err; return ret;
} }
max_frame_len = ag71xx_max_frame_len(ndev->mtu); max_frame_len = ag71xx_max_frame_len(ndev->mtu);
...@@ -1448,6 +1448,7 @@ static int ag71xx_open(struct net_device *ndev) ...@@ -1448,6 +1448,7 @@ static int ag71xx_open(struct net_device *ndev)
err: err:
ag71xx_rings_cleanup(ag); ag71xx_rings_cleanup(ag);
phylink_disconnect_phy(ag->phylink);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment