Skip to content

Commit b1dbe19

Browse files
Uwe Kleine-Königmiquelraynal
authored andcommitted
mtd: maps: physmap-core: 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 5882bf9 commit b1dbe19

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/mtd/maps/physmap-core.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ struct physmap_flash_info {
6262
unsigned int win_order;
6363
};
6464

65-
static int physmap_flash_remove(struct platform_device *dev)
65+
static void physmap_flash_remove(struct platform_device *dev)
6666
{
6767
struct physmap_flash_info *info;
6868
struct physmap_flash_data *physmap_data;
@@ -88,7 +88,6 @@ static int physmap_flash_remove(struct platform_device *dev)
8888

8989
pm_runtime_put(&dev->dev);
9090
pm_runtime_disable(&dev->dev);
91-
return 0;
9291
}
9392

9493
static void physmap_set_vpp(struct map_info *map, int state)
@@ -615,7 +614,7 @@ static void physmap_flash_shutdown(struct platform_device *dev)
615614

616615
static struct platform_driver physmap_flash_driver = {
617616
.probe = physmap_flash_probe,
618-
.remove = physmap_flash_remove,
617+
.remove_new = physmap_flash_remove,
619618
.shutdown = physmap_flash_shutdown,
620619
.driver = {
621620
.name = "physmap-flash",

0 commit comments

Comments
 (0)