Skip to content

Commit 8739312

Browse files
Uwe Kleine-Königmpe
authored andcommitted
powerpc/512x: lpbfifo: 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 this driver 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: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20230711143145.1192651-1-u.kleine-koenig@pengutronix.de
1 parent fb74c4e commit 8739312

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

arch/powerpc/platforms/512x/mpc512x_lpbfifo.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ static int mpc512x_lpbfifo_probe(struct platform_device *pdev)
477477
return ret;
478478
}
479479

480-
static int mpc512x_lpbfifo_remove(struct platform_device *pdev)
480+
static void mpc512x_lpbfifo_remove(struct platform_device *pdev)
481481
{
482482
unsigned long flags;
483483
struct dma_device *dma_dev = lpbfifo.chan->device;
@@ -494,8 +494,6 @@ static int mpc512x_lpbfifo_remove(struct platform_device *pdev)
494494
free_irq(lpbfifo.irq, &pdev->dev);
495495
irq_dispose_mapping(lpbfifo.irq);
496496
dma_release_channel(lpbfifo.chan);
497-
498-
return 0;
499497
}
500498

501499
static const struct of_device_id mpc512x_lpbfifo_match[] = {
@@ -506,7 +504,7 @@ MODULE_DEVICE_TABLE(of, mpc512x_lpbfifo_match);
506504

507505
static struct platform_driver mpc512x_lpbfifo_driver = {
508506
.probe = mpc512x_lpbfifo_probe,
509-
.remove = mpc512x_lpbfifo_remove,
507+
.remove_new = mpc512x_lpbfifo_remove,
510508
.driver = {
511509
.name = DRV_NAME,
512510
.of_match_table = mpc512x_lpbfifo_match,

0 commit comments

Comments
 (0)