Skip to content

Commit 54600e4

Browse files
Uwe Kleine-Königmiquelraynal
authored andcommitted
mtd: lpddr2_nvm: 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 baaa90c commit 54600e4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/mtd/lpddr/lpddr2_nvm.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,11 +476,9 @@ static int lpddr2_nvm_probe(struct platform_device *pdev)
476476
/*
477477
* lpddr2_nvm driver remove method
478478
*/
479-
static int lpddr2_nvm_remove(struct platform_device *pdev)
479+
static void lpddr2_nvm_remove(struct platform_device *pdev)
480480
{
481481
WARN_ON(mtd_device_unregister(dev_get_drvdata(&pdev->dev)));
482-
483-
return 0;
484482
}
485483

486484
/* Initialize platform_driver data structure for lpddr2_nvm */
@@ -489,7 +487,7 @@ static struct platform_driver lpddr2_nvm_drv = {
489487
.name = "lpddr2_nvm",
490488
},
491489
.probe = lpddr2_nvm_probe,
492-
.remove = lpddr2_nvm_remove,
490+
.remove_new = lpddr2_nvm_remove,
493491
};
494492

495493
module_platform_driver(lpddr2_nvm_drv);

0 commit comments

Comments
 (0)