Skip to content

Commit ac2bc65

Browse files
Uwe Kleine-Königmiquelraynal
authored andcommitted
mtd: spi-nor: hisi-sfc: 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() will be 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 <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Acked-by: Tudor Ambarus <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent e0748d6 commit ac2bc65

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/mtd/spi-nor/controllers/hisi-sfc.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,13 +468,12 @@ static int hisi_spi_nor_probe(struct platform_device *pdev)
468468
return ret;
469469
}
470470

471-
static int hisi_spi_nor_remove(struct platform_device *pdev)
471+
static void hisi_spi_nor_remove(struct platform_device *pdev)
472472
{
473473
struct hifmc_host *host = platform_get_drvdata(pdev);
474474

475475
hisi_spi_nor_unregister_all(host);
476476
mutex_destroy(&host->lock);
477-
return 0;
478477
}
479478

480479
static const struct of_device_id hisi_spi_nor_dt_ids[] = {
@@ -489,7 +488,7 @@ static struct platform_driver hisi_spi_nor_driver = {
489488
.of_match_table = hisi_spi_nor_dt_ids,
490489
},
491490
.probe = hisi_spi_nor_probe,
492-
.remove = hisi_spi_nor_remove,
491+
.remove_new = hisi_spi_nor_remove,
493492
};
494493
module_platform_driver(hisi_spi_nor_driver);
495494

0 commit comments

Comments
 (0)