Skip to content

Commit 70680f1

Browse files
Uwe Kleine-Königdavem330
authored andcommitted
net: ethernet: via: 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 2f96195 commit 70680f1

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

drivers/net/ethernet/via/via-rhine.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2443,7 +2443,7 @@ static void rhine_remove_one_pci(struct pci_dev *pdev)
24432443
pci_disable_device(pdev);
24442444
}
24452445

2446-
static int rhine_remove_one_platform(struct platform_device *pdev)
2446+
static void rhine_remove_one_platform(struct platform_device *pdev)
24472447
{
24482448
struct net_device *dev = platform_get_drvdata(pdev);
24492449
struct rhine_private *rp = netdev_priv(dev);
@@ -2453,8 +2453,6 @@ static int rhine_remove_one_platform(struct platform_device *pdev)
24532453
iounmap(rp->base);
24542454

24552455
free_netdev(dev);
2456-
2457-
return 0;
24582456
}
24592457

24602458
static void rhine_shutdown_pci(struct pci_dev *pdev)
@@ -2572,7 +2570,7 @@ static struct pci_driver rhine_driver_pci = {
25722570

25732571
static struct platform_driver rhine_driver_platform = {
25742572
.probe = rhine_init_one_platform,
2575-
.remove = rhine_remove_one_platform,
2573+
.remove_new = rhine_remove_one_platform,
25762574
.driver = {
25772575
.name = DRV_NAME,
25782576
.of_match_table = rhine_of_tbl,

drivers/net/ethernet/via/via-velocity.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2957,11 +2957,9 @@ static int velocity_platform_probe(struct platform_device *pdev)
29572957
return velocity_probe(&pdev->dev, irq, info, BUS_PLATFORM);
29582958
}
29592959

2960-
static int velocity_platform_remove(struct platform_device *pdev)
2960+
static void velocity_platform_remove(struct platform_device *pdev)
29612961
{
29622962
velocity_remove(&pdev->dev);
2963-
2964-
return 0;
29652963
}
29662964

29672965
#ifdef CONFIG_PM_SLEEP
@@ -3249,7 +3247,7 @@ static struct pci_driver velocity_pci_driver = {
32493247

32503248
static struct platform_driver velocity_platform_driver = {
32513249
.probe = velocity_platform_probe,
3252-
.remove = velocity_platform_remove,
3250+
.remove_new = velocity_platform_remove,
32533251
.driver = {
32543252
.name = "via-velocity",
32553253
.of_match_table = velocity_of_ids,

0 commit comments

Comments
 (0)