Skip to content

Commit 3ee355d

Browse files
Uwe Kleine-Königmiquelraynal
authored andcommitted
mtd: spi-nor: nxp-spifi: 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 ac2bc65 commit 3ee355d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/mtd/spi-nor/controllers/nxp-spifi.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,13 +431,11 @@ static int nxp_spifi_probe(struct platform_device *pdev)
431431
return 0;
432432
}
433433

434-
static int nxp_spifi_remove(struct platform_device *pdev)
434+
static void nxp_spifi_remove(struct platform_device *pdev)
435435
{
436436
struct nxp_spifi *spifi = platform_get_drvdata(pdev);
437437

438438
mtd_device_unregister(&spifi->nor.mtd);
439-
440-
return 0;
441439
}
442440

443441
static const struct of_device_id nxp_spifi_match[] = {
@@ -448,7 +446,7 @@ MODULE_DEVICE_TABLE(of, nxp_spifi_match);
448446

449447
static struct platform_driver nxp_spifi_driver = {
450448
.probe = nxp_spifi_probe,
451-
.remove = nxp_spifi_remove,
449+
.remove_new = nxp_spifi_remove,
452450
.driver = {
453451
.name = "nxp-spifi",
454452
.of_match_table = nxp_spifi_match,

0 commit comments

Comments
 (0)