9c526ecec93ad7f47f9b589d33f8e32108f5a49e
[openwrt/staging/ansuel.git] /
1 From 8110437e59616293228cd781c486d8495a61e36a Mon Sep 17 00:00:00 2001
2 From: Yan Cangang <nalanzeyu@gmail.com>
3 Date: Sun, 20 Nov 2022 13:52:58 +0800
4 Subject: [PATCH] net: ethernet: mtk_eth_soc: fix resource leak in error path
5
6 In mtk_probe(), when mtk_ppe_init() or mtk_eth_offload_init() failed,
7 mtk_mdio_cleanup() isn't called. Fix it.
8
9 Fixes: ba37b7caf1ed ("net: ethernet: mtk_eth_soc: add support for initializing the PPE")
10 Fixes: 502e84e2382d ("net: ethernet: mtk_eth_soc: add flow offloading support")
11 Signed-off-by: Yan Cangang <nalanzeyu@gmail.com>
12 Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
13 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
14 ---
15 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++--
16 1 file changed, 2 insertions(+), 2 deletions(-)
17
18 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
19 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
20 @@ -4090,13 +4090,13 @@ static int mtk_probe(struct platform_dev
21 eth->soc->offload_version, i);
22 if (!eth->ppe[i]) {
23 err = -ENOMEM;
24 - goto err_free_dev;
25 + goto err_deinit_mdio;
26 }
27 }
28
29 err = mtk_eth_offload_init(eth);
30 if (err)
31 - goto err_free_dev;
32 + goto err_deinit_mdio;
33 }
34
35 for (i = 0; i < MTK_MAX_DEVS; i++) {