net: fs_enet: add missing kfree in _remove
Subsystems (3)
PATCH 1/1 net: fs_enet: add missing kfree in _remove
The kfree is present in _probe on failure but not in remove.
--- drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +1 -0
@@ -1008,6 +1008,7 @@ static void fs_enet_remove(struct platform_device *ofdev)dev_set_drvdata (fep->dev,NULL );phylink_destroy (fep->phylink);free_netdev (ndev); +kfree (fep); }static const struct of_device_id fs_enet_match[] = {
--
2.53.0
Le 24/02/2026 à 02:55, Rosen Penev a écrit :
Quoted 1 line
The kfree is present in
_probeon failure but not in remove.
Which kfree ? Which structure ?
Provide more details in the commit message.
Quoted 11 lines
Signed-off-by Rosen Penev <[email protected]>--- drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 1 + 1 file changed, 1 insertion(+)drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +0
-0
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c static void fs_enet_remove(struct platform_device *ofdev) · line 1011
Quoted 4 lines
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +1
-0@@ -1008,6 +1008,7 @@ static void fs_enet_remove(struct platform_device *ofdev)dev_set_drvdata (fep->dev,NULL );phylink_destroy (fep->phylink);free_netdev (ndev); +kfree (fep);
This is not correct I think. fep is allocated by alloc_etherdev() and released by free_netdev()
Quoted 7 lines
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +0
-1}static const struct of_device_id fs_enet_match[] = { --2.53.0
Quoted 7 lines · Christophe Leroy (CS GROUP)
Quoted 1 line · Rosen Penev
The kfree is present in
_probeon failure but not in remove.Which kfree ? Which structure ?
probe has
out_free_bd:
fep->ops->free_bd(ndev);
out_cleanup_data:
fep->ops->cleanup_data(ndev);
out_phylink:
phylink_destroy(fep->phylink);
out_free_dev:
free_netdev(ndev);
out_free_fpi:
kfree(fpi);remove has only
'
fep->ops->free_bd(ndev);
fep->ops->cleanup_data(ndev);
dev_set_drvdata(fep->dev, NULL);
phylink_destroy(fep->phylink);
free_netdev(ndev);Conversion to devm would fix all of this but I got yelled at last time I did devm conversions for netdev drivers, even when I have the hardware to test.
Quoted 30 lines
Provide more details in the commit message.
Quoted 11 lines
Signed-off-by Rosen Penev <[email protected]>--- drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 1 + 1 file changed, 1 insertion(+)drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +0
-0drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c static void fs_enet_remove(struct platform_device *ofdev) · line 1011
Quoted 4 lines
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +1
-0@@ -1008,6 +1008,7 @@ static void fs_enet_remove(struct platform_device *ofdev)dev_set_drvdata (fep->dev,NULL );phylink_destroy (fep->phylink);free_netdev (ndev); +kfree (fep);This is not correct I think. fep is allocated by
alloc_etherdev()and released byfree_netdev()Quoted 7 lines
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +0
-1}static const struct of_device_id fs_enet_match[] = { --2.53.0
Jakub Kicinski
maintainerQuoted 7 lines · On Tue, 24 Feb 2026 14:24:53 -0800 Rosen Penev wrote:
Quoted 4 lines · Rosen Penev
Quoted 1 line
The kfree is present in
_probeon failure but not in remove.Which kfree ? Which structure ?
probe has
out_free_bd:
Quoted 9 lines
fep->ops->free_bd(ndev);
out_cleanup_data:
fep->ops->cleanup_data(ndev);
out_phylink:
phylink_destroy(fep->phylink);
out_free_dev:
free_netdev(ndev);
out_free_fpi:
kfree(fpi);This says fpi, not fep. Which is what Christophe was telling you.
Please add a Fixes tag when you send v2