Skip to content

Commit 2e0ec0a

Browse files
Uwe Kleine-Königdavem330
authored andcommitted
net: ethernet: xilinx: 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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert these drivers from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 46b5668 commit 2e0ec0a

3 files changed

Lines changed: 6 additions & 11 deletions

File tree

drivers/net/ethernet/xilinx/ll_temac_main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,7 +1626,7 @@ static int temac_probe(struct platform_device *pdev)
16261626
return rc;
16271627
}
16281628

1629-
static int temac_remove(struct platform_device *pdev)
1629+
static void temac_remove(struct platform_device *pdev)
16301630
{
16311631
struct net_device *ndev = platform_get_drvdata(pdev);
16321632
struct temac_local *lp = netdev_priv(ndev);
@@ -1636,7 +1636,6 @@ static int temac_remove(struct platform_device *pdev)
16361636
if (lp->phy_node)
16371637
of_node_put(lp->phy_node);
16381638
temac_mdio_teardown(lp);
1639-
return 0;
16401639
}
16411640

16421641
static const struct of_device_id temac_of_match[] = {
@@ -1650,7 +1649,7 @@ MODULE_DEVICE_TABLE(of, temac_of_match);
16501649

16511650
static struct platform_driver temac_driver = {
16521651
.probe = temac_probe,
1653-
.remove = temac_remove,
1652+
.remove_new = temac_remove,
16541653
.driver = {
16551654
.name = "xilinx_temac",
16561655
.of_match_table = temac_of_match,

drivers/net/ethernet/xilinx/xilinx_axienet_main.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,7 +2183,7 @@ static int axienet_probe(struct platform_device *pdev)
21832183
return ret;
21842184
}
21852185

2186-
static int axienet_remove(struct platform_device *pdev)
2186+
static void axienet_remove(struct platform_device *pdev)
21872187
{
21882188
struct net_device *ndev = platform_get_drvdata(pdev);
21892189
struct axienet_local *lp = netdev_priv(ndev);
@@ -2202,8 +2202,6 @@ static int axienet_remove(struct platform_device *pdev)
22022202
clk_disable_unprepare(lp->axi_clk);
22032203

22042204
free_netdev(ndev);
2205-
2206-
return 0;
22072205
}
22082206

22092207
static void axienet_shutdown(struct platform_device *pdev)
@@ -2256,7 +2254,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(axienet_pm_ops,
22562254

22572255
static struct platform_driver axienet_driver = {
22582256
.probe = axienet_probe,
2259-
.remove = axienet_remove,
2257+
.remove_new = axienet_remove,
22602258
.shutdown = axienet_shutdown,
22612259
.driver = {
22622260
.name = "xilinx_axienet",

drivers/net/ethernet/xilinx/xilinx_emaclite.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
11831183
*
11841184
* Return: 0, always.
11851185
*/
1186-
static int xemaclite_of_remove(struct platform_device *of_dev)
1186+
static void xemaclite_of_remove(struct platform_device *of_dev)
11871187
{
11881188
struct net_device *ndev = platform_get_drvdata(of_dev);
11891189

@@ -1202,8 +1202,6 @@ static int xemaclite_of_remove(struct platform_device *of_dev)
12021202
lp->phy_node = NULL;
12031203

12041204
free_netdev(ndev);
1205-
1206-
return 0;
12071205
}
12081206

12091207
#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -1262,7 +1260,7 @@ static struct platform_driver xemaclite_of_driver = {
12621260
.of_match_table = xemaclite_of_match,
12631261
},
12641262
.probe = xemaclite_of_probe,
1265-
.remove = xemaclite_of_remove,
1263+
.remove_new = xemaclite_of_remove,
12661264
};
12671265

12681266
module_platform_driver(xemaclite_of_driver);

0 commit comments

Comments
 (0)