Skip to content

Commit 904e582

Browse files
Uwe Kleine-Königsre
authored andcommitted
power: reset: as3722-poweroff: 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 <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20231104211501.3676352-20-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent dde74a5 commit 904e582

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/power/reset/as3722-poweroff.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,19 @@ static int as3722_poweroff_probe(struct platform_device *pdev)
6161
return 0;
6262
}
6363

64-
static int as3722_poweroff_remove(struct platform_device *pdev)
64+
static void as3722_poweroff_remove(struct platform_device *pdev)
6565
{
6666
if (pm_power_off == as3722_pm_power_off)
6767
pm_power_off = NULL;
6868
as3722_pm_poweroff = NULL;
69-
70-
return 0;
7169
}
7270

7371
static struct platform_driver as3722_poweroff_driver = {
7472
.driver = {
7573
.name = "as3722-power-off",
7674
},
7775
.probe = as3722_poweroff_probe,
78-
.remove = as3722_poweroff_remove,
76+
.remove_new = as3722_poweroff_remove,
7977
};
8078

8179
module_platform_driver(as3722_poweroff_driver);

0 commit comments

Comments
 (0)