[PATCH] xgene-v2: Fix a resource leak in the error handling path of 'xge_probe()'

Subsystems: applied micro (apm) x-gene soc ethernet (v2) driver, networking drivers, the rest

STALE1809d

2 messages, 2 authors, 2021-08-23 · open the first message on its own page

[PATCH] xgene-v2: Fix a resource leak in the error handling path of 'xge_probe()'

From: Christophe JAILLET <hidden>
Date: 2021-08-21 07:35:37

A successful 'xge_mdio_config()' call should be balanced by a corresponding
'xge_mdio_remove()' call in the error handling path of the probe, as
already done in the remove function.

Update the error handling path accordingly.

Fixes: ea8ab16ab225 ("drivers: net: xgene-v2: Add MDIO support")
Signed-off-by: Christophe JAILLET <redacted>
---
 drivers/net/ethernet/apm/xgene-v2/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/apm/xgene-v2/main.c b/drivers/net/ethernet/apm/xgene-v2/main.c
index 860c18fb7aae..80399c8980bd 100644
--- a/drivers/net/ethernet/apm/xgene-v2/main.c
+++ b/drivers/net/ethernet/apm/xgene-v2/main.c
@@ -677,11 +677,13 @@ static int xge_probe(struct platform_device *pdev)
 	ret = register_netdev(ndev);
 	if (ret) {
 		netdev_err(ndev, "Failed to register netdev\n");
-		goto err;
+		goto err_mdio_remove;
 	}
 
 	return 0;
 
+err_mdio_remove:
+	xge_mdio_remove(ndev);
 err:
 	free_netdev(ndev);
 
-- 
2.30.2

Re: [PATCH] xgene-v2: Fix a resource leak in the error handling path of 'xge_probe()'

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-08-23 10:50:14

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Sat, 21 Aug 2021 09:35:23 +0200 you wrote:
A successful 'xge_mdio_config()' call should be balanced by a corresponding
'xge_mdio_remove()' call in the error handling path of the probe, as
already done in the remove function.

Update the error handling path accordingly.

Fixes: ea8ab16ab225 ("drivers: net: xgene-v2: Add MDIO support")
Signed-off-by: Christophe JAILLET <redacted>

[...]
Here is the summary with links:
  - xgene-v2: Fix a resource leak in the error handling path of 'xge_probe()'
    https://git.kernel.org/netdev/net/c/5ed74b03eb4d

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help