Skip to content

Commit 09a8b9c

Browse files
Uwe Kleine-Königmiquelraynal
authored andcommitted
mtd: phram: 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 eb0cec7 commit 09a8b9c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/mtd/devices/phram.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,20 +388,18 @@ static int phram_probe(struct platform_device *pdev)
388388
PAGE_SIZE);
389389
}
390390

391-
static int phram_remove(struct platform_device *pdev)
391+
static void phram_remove(struct platform_device *pdev)
392392
{
393393
struct phram_mtd_list *phram = platform_get_drvdata(pdev);
394394

395395
mtd_device_unregister(&phram->mtd);
396396
phram_unmap(phram);
397397
kfree(phram);
398-
399-
return 0;
400398
}
401399

402400
static struct platform_driver phram_driver = {
403401
.probe = phram_probe,
404-
.remove = phram_remove,
402+
.remove_new = phram_remove,
405403
.driver = {
406404
.name = "phram",
407405
.of_match_table = of_match_ptr(phram_of_match),

0 commit comments

Comments
 (0)