Skip to content

Commit 46b5668

Browse files
Uwe Kleine-Königdavem330
authored andcommitted
net: ethernet: wiznet: 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 70680f1 commit 46b5668

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

drivers/net/ethernet/wiznet/w5100.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,11 +1062,9 @@ static int w5100_mmio_probe(struct platform_device *pdev)
10621062
mac_addr, irq, data ? data->link_gpio : -EINVAL);
10631063
}
10641064

1065-
static int w5100_mmio_remove(struct platform_device *pdev)
1065+
static void w5100_mmio_remove(struct platform_device *pdev)
10661066
{
10671067
w5100_remove(&pdev->dev);
1068-
1069-
return 0;
10701068
}
10711069

10721070
void *w5100_ops_priv(const struct net_device *ndev)
@@ -1273,6 +1271,6 @@ static struct platform_driver w5100_mmio_driver = {
12731271
.pm = &w5100_pm_ops,
12741272
},
12751273
.probe = w5100_mmio_probe,
1276-
.remove = w5100_mmio_remove,
1274+
.remove_new = w5100_mmio_remove,
12771275
};
12781276
module_platform_driver(w5100_mmio_driver);

drivers/net/ethernet/wiznet/w5300.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ static int w5300_probe(struct platform_device *pdev)
627627
return err;
628628
}
629629

630-
static int w5300_remove(struct platform_device *pdev)
630+
static void w5300_remove(struct platform_device *pdev)
631631
{
632632
struct net_device *ndev = platform_get_drvdata(pdev);
633633
struct w5300_priv *priv = netdev_priv(ndev);
@@ -639,7 +639,6 @@ static int w5300_remove(struct platform_device *pdev)
639639

640640
unregister_netdev(ndev);
641641
free_netdev(ndev);
642-
return 0;
643642
}
644643

645644
#ifdef CONFIG_PM_SLEEP
@@ -683,7 +682,7 @@ static struct platform_driver w5300_driver = {
683682
.pm = &w5300_pm_ops,
684683
},
685684
.probe = w5300_probe,
686-
.remove = w5300_remove,
685+
.remove_new = w5300_remove,
687686
};
688687

689688
module_platform_driver(w5300_driver);

0 commit comments

Comments
 (0)