net: ethernet: mtk_eth_soc: fix resource leak in error path

In mtk_probe(), when mtk_ppe_init() or mtk_eth_offload_init() failed,
mtk_mdio_cleanup() isn't called. Fix it.

Fixes: ba37b7caf1 ("net: ethernet: mtk_eth_soc: add support for initializing the PPE")
Fixes: 502e84e238 ("net: ethernet: mtk_eth_soc: add flow offloading support")
Signed-off-by: Yan Cangang <nalanzeyu@gmail.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Yan Cangang 2022-11-20 13:52:58 +08:00 committed by Jakub Kicinski
parent 3213f808ae
commit 8110437e59

View File

@ -4147,13 +4147,13 @@ static int mtk_probe(struct platform_device *pdev)
eth->soc->offload_version, i);
if (!eth->ppe[i]) {
err = -ENOMEM;
goto err_free_dev;
goto err_deinit_mdio;
}
}
err = mtk_eth_offload_init(eth);
if (err)
goto err_free_dev;
goto err_deinit_mdio;
}
for (i = 0; i < MTK_MAX_DEVS; i++) {