[PATCH] net: bgmac: Fix an erroneous kfree() in bgmac_remove()

Christophe JAILLET posted 1 patch 3 years, 10 months ago
drivers/net/ethernet/broadcom/bgmac-bcma.c | 1 -
1 file changed, 1 deletion(-)
[PATCH] net: bgmac: Fix an erroneous kfree() in bgmac_remove()
Posted by Christophe JAILLET 3 years, 10 months ago
'bgmac' is part of a managed resource allocated with bgmac_alloc(). It
should not be freed explicitly.

Remove the erroneous kfree() from the .remove() function.

Fixes: 34a5102c3235 ("net: bgmac: allocate struct bgmac just once & don't copy it"
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/broadcom/bgmac-bcma.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bgmac-bcma.c b/drivers/net/ethernet/broadcom/bgmac-bcma.c
index e6f48786949c..02bd3cf9a260 100644
--- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
@@ -332,7 +332,6 @@ static void bgmac_remove(struct bcma_device *core)
 	bcma_mdio_mii_unregister(bgmac->mii_bus);
 	bgmac_enet_remove(bgmac);
 	bcma_set_drvdata(core, NULL);
-	kfree(bgmac);
 }
 
 static struct bcma_driver bgmac_bcma_driver = {
-- 
2.34.1
Re: [PATCH] net: bgmac: Fix an erroneous kfree() in bgmac_remove()
Posted by patchwork-bot+netdevbpf@kernel.org 3 years, 10 months ago
Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 13 Jun 2022 22:53:50 +0200 you wrote:
> 'bgmac' is part of a managed resource allocated with bgmac_alloc(). It
> should not be freed explicitly.
> 
> Remove the erroneous kfree() from the .remove() function.
> 
> Fixes: 34a5102c3235 ("net: bgmac: allocate struct bgmac just once & don't copy it"
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> [...]

Here is the summary with links:
  - net: bgmac: Fix an erroneous kfree() in bgmac_remove()
    https://git.kernel.org/netdev/net/c/d7dd6eccfbc9

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Re: [PATCH] net: bgmac: Fix an erroneous kfree() in bgmac_remove()
Posted by Florian Fainelli 3 years, 10 months ago
On 6/13/22 13:53, Christophe JAILLET wrote:
> 'bgmac' is part of a managed resource allocated with bgmac_alloc(). It
> should not be freed explicitly.
> 
> Remove the erroneous kfree() from the .remove() function.
> 
> Fixes: 34a5102c3235 ("net: bgmac: allocate struct bgmac just once & don't copy it"
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian