Skip to content

Commit

Permalink
net: ag71xx: call phylink_disconnect_phy if ag71xx_hw_enable() fail i…
Browse files Browse the repository at this point in the history
…n ag71xx_open()

[ Upstream commit c9b895c ]

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: 892e091 ("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>
  • Loading branch information
liujian56 authored and gregkh committed Nov 26, 2022
1 parent d615d70 commit 06b6c4b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/atheros/ag71xx.c
Expand Up @@ -1427,7 +1427,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);
Expand All @@ -1448,6 +1448,7 @@ static int ag71xx_open(struct net_device *ndev)

err:
ag71xx_rings_cleanup(ag);
phylink_disconnect_phy(ag->phylink);
return ret;
}

Expand Down

0 comments on commit 06b6c4b

Please sign in to comment.