Skip to content

Commit c306171

Browse files
Uwe Kleine-Königdavem330
authored andcommitted
net: dsa: b53: 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> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6f0b985 commit c306171

2 files changed

Lines changed: 5 additions & 9 deletions

File tree

drivers/net/dsa/b53/b53_mmap.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,14 +324,12 @@ static int b53_mmap_probe(struct platform_device *pdev)
324324
return b53_switch_register(dev);
325325
}
326326

327-
static int b53_mmap_remove(struct platform_device *pdev)
327+
static void b53_mmap_remove(struct platform_device *pdev)
328328
{
329329
struct b53_device *dev = platform_get_drvdata(pdev);
330330

331331
if (dev)
332332
b53_switch_remove(dev);
333-
334-
return 0;
335333
}
336334

337335
static void b53_mmap_shutdown(struct platform_device *pdev)
@@ -372,7 +370,7 @@ MODULE_DEVICE_TABLE(of, b53_mmap_of_table);
372370

373371
static struct platform_driver b53_mmap_driver = {
374372
.probe = b53_mmap_probe,
375-
.remove = b53_mmap_remove,
373+
.remove_new = b53_mmap_remove,
376374
.shutdown = b53_mmap_shutdown,
377375
.driver = {
378376
.name = "b53-switch",

drivers/net/dsa/b53/b53_srab.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -657,17 +657,15 @@ static int b53_srab_probe(struct platform_device *pdev)
657657
return b53_switch_register(dev);
658658
}
659659

660-
static int b53_srab_remove(struct platform_device *pdev)
660+
static void b53_srab_remove(struct platform_device *pdev)
661661
{
662662
struct b53_device *dev = platform_get_drvdata(pdev);
663663

664664
if (!dev)
665-
return 0;
665+
return;
666666

667667
b53_srab_intr_set(dev->priv, false);
668668
b53_switch_remove(dev);
669-
670-
return 0;
671669
}
672670

673671
static void b53_srab_shutdown(struct platform_device *pdev)
@@ -684,7 +682,7 @@ static void b53_srab_shutdown(struct platform_device *pdev)
684682

685683
static struct platform_driver b53_srab_driver = {
686684
.probe = b53_srab_probe,
687-
.remove = b53_srab_remove,
685+
.remove_new = b53_srab_remove,
688686
.shutdown = b53_srab_shutdown,
689687
.driver = {
690688
.name = "b53-srab-switch",

0 commit comments

Comments
 (0)