Skip to content

Commit 677edf7

Browse files
Uwe Kleine-Königmiquelraynal
authored andcommitted
mtd: maps: plat-ram: 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 b1dbe19 commit 677edf7

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/mtd/maps/plat-ram.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ static inline void platram_setrw(struct platram_info *info, int to)
6565
* called to remove the device from the driver's control
6666
*/
6767

68-
static int platram_remove(struct platform_device *pdev)
68+
static void platram_remove(struct platform_device *pdev)
6969
{
7070
struct platram_info *info = to_platram_info(pdev);
7171

7272
dev_dbg(&pdev->dev, "removing device\n");
7373

7474
if (info == NULL)
75-
return 0;
75+
return;
7676

7777
if (info->mtd) {
7878
mtd_device_unregister(info->mtd);
@@ -84,8 +84,6 @@ static int platram_remove(struct platform_device *pdev)
8484
platram_setrw(info, PLATRAM_RO);
8585

8686
kfree(info);
87-
88-
return 0;
8987
}
9088

9189
/* platram_probe
@@ -207,7 +205,7 @@ MODULE_ALIAS("platform:mtd-ram");
207205

208206
static struct platform_driver platram_driver = {
209207
.probe = platram_probe,
210-
.remove = platram_remove,
208+
.remove_new = platram_remove,
211209
.driver = {
212210
.name = "mtd-ram",
213211
},

0 commit comments

Comments
 (0)