mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 13:06:59 +02:00
net: ethernet: mtk_eth_soc: fix error handling in mtk_open()
[ Upstream commitf700741405] If mtk_start_dma() fails, invoke phylink_disconnect_phy() to perform cleanup. phylink_disconnect_phy() contains the put_device action. If phylink_disconnect_phy is not performed, the Kref of netdev will leak. Fixes:b8fc9f3082("net: ethernet: mediatek: Add basic PHYLINK support") Signed-off-by: Liu Jian <liujian56@huawei.com> Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://lore.kernel.org/r/20221117111356.161547-1-liujian56@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
756534f7cf
commit
da86a63479
|
|
@ -2299,7 +2299,10 @@ static int mtk_open(struct net_device *dev)
|
||||||
int err = mtk_start_dma(eth);
|
int err = mtk_start_dma(eth);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
|
if (err) {
|
||||||
|
phylink_disconnect_phy(mac->phylink);
|
||||||
return err;
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
mtk_gdm_config(eth, MTK_GDMA_TO_PDMA);
|
mtk_gdm_config(eth, MTK_GDMA_TO_PDMA);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user