Commit ead29c5e authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Jakub Kicinski

net: fs_enet: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Reviewed-by: default avatarMichal Kubiak <michal.kubiak@intel.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230710071946.3470249-6-u.kleine-koenig@pengutronix.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 4875b2a3
...@@ -1051,7 +1051,7 @@ static int fs_enet_probe(struct platform_device *ofdev) ...@@ -1051,7 +1051,7 @@ static int fs_enet_probe(struct platform_device *ofdev)
return ret; return ret;
} }
static int fs_enet_remove(struct platform_device *ofdev) static void fs_enet_remove(struct platform_device *ofdev)
{ {
struct net_device *ndev = platform_get_drvdata(ofdev); struct net_device *ndev = platform_get_drvdata(ofdev);
struct fs_enet_private *fep = netdev_priv(ndev); struct fs_enet_private *fep = netdev_priv(ndev);
...@@ -1066,7 +1066,6 @@ static int fs_enet_remove(struct platform_device *ofdev) ...@@ -1066,7 +1066,6 @@ static int fs_enet_remove(struct platform_device *ofdev)
if (of_phy_is_fixed_link(ofdev->dev.of_node)) if (of_phy_is_fixed_link(ofdev->dev.of_node))
of_phy_deregister_fixed_link(ofdev->dev.of_node); of_phy_deregister_fixed_link(ofdev->dev.of_node);
free_netdev(ndev); free_netdev(ndev);
return 0;
} }
static const struct of_device_id fs_enet_match[] = { static const struct of_device_id fs_enet_match[] = {
...@@ -1113,7 +1112,7 @@ static struct platform_driver fs_enet_driver = { ...@@ -1113,7 +1112,7 @@ static struct platform_driver fs_enet_driver = {
.of_match_table = fs_enet_match, .of_match_table = fs_enet_match,
}, },
.probe = fs_enet_probe, .probe = fs_enet_probe,
.remove = fs_enet_remove, .remove_new = fs_enet_remove,
}; };
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
......
...@@ -192,7 +192,7 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev) ...@@ -192,7 +192,7 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev)
return ret; return ret;
} }
static int fs_enet_mdio_remove(struct platform_device *ofdev) static void fs_enet_mdio_remove(struct platform_device *ofdev)
{ {
struct mii_bus *bus = platform_get_drvdata(ofdev); struct mii_bus *bus = platform_get_drvdata(ofdev);
struct bb_info *bitbang = bus->priv; struct bb_info *bitbang = bus->priv;
...@@ -201,8 +201,6 @@ static int fs_enet_mdio_remove(struct platform_device *ofdev) ...@@ -201,8 +201,6 @@ static int fs_enet_mdio_remove(struct platform_device *ofdev)
free_mdio_bitbang(bus); free_mdio_bitbang(bus);
iounmap(bitbang->dir); iounmap(bitbang->dir);
kfree(bitbang); kfree(bitbang);
return 0;
} }
static const struct of_device_id fs_enet_mdio_bb_match[] = { static const struct of_device_id fs_enet_mdio_bb_match[] = {
...@@ -219,7 +217,7 @@ static struct platform_driver fs_enet_bb_mdio_driver = { ...@@ -219,7 +217,7 @@ static struct platform_driver fs_enet_bb_mdio_driver = {
.of_match_table = fs_enet_mdio_bb_match, .of_match_table = fs_enet_mdio_bb_match,
}, },
.probe = fs_enet_mdio_probe, .probe = fs_enet_mdio_probe,
.remove = fs_enet_mdio_remove, .remove_new = fs_enet_mdio_remove,
}; };
module_platform_driver(fs_enet_bb_mdio_driver); module_platform_driver(fs_enet_bb_mdio_driver);
......
...@@ -187,7 +187,7 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev) ...@@ -187,7 +187,7 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev)
return ret; return ret;
} }
static int fs_enet_mdio_remove(struct platform_device *ofdev) static void fs_enet_mdio_remove(struct platform_device *ofdev)
{ {
struct mii_bus *bus = platform_get_drvdata(ofdev); struct mii_bus *bus = platform_get_drvdata(ofdev);
struct fec_info *fec = bus->priv; struct fec_info *fec = bus->priv;
...@@ -196,8 +196,6 @@ static int fs_enet_mdio_remove(struct platform_device *ofdev) ...@@ -196,8 +196,6 @@ static int fs_enet_mdio_remove(struct platform_device *ofdev)
iounmap(fec->fecp); iounmap(fec->fecp);
kfree(fec); kfree(fec);
mdiobus_free(bus); mdiobus_free(bus);
return 0;
} }
static const struct of_device_id fs_enet_mdio_fec_match[] = { static const struct of_device_id fs_enet_mdio_fec_match[] = {
...@@ -220,7 +218,7 @@ static struct platform_driver fs_enet_fec_mdio_driver = { ...@@ -220,7 +218,7 @@ static struct platform_driver fs_enet_fec_mdio_driver = {
.of_match_table = fs_enet_mdio_fec_match, .of_match_table = fs_enet_mdio_fec_match,
}, },
.probe = fs_enet_mdio_probe, .probe = fs_enet_mdio_probe,
.remove = fs_enet_mdio_remove, .remove_new = fs_enet_mdio_remove,
}; };
module_platform_driver(fs_enet_fec_mdio_driver); module_platform_driver(fs_enet_fec_mdio_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment