Skip to content

Commit aedd4da

Browse files
Uwe Kleine-Königsre
authored andcommitted
power: reset: restart-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-27-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent 6f7be7b commit aedd4da

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/power/reset/restart-poweroff.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,10 @@ static int restart_poweroff_probe(struct platform_device *pdev)
3333
return 0;
3434
}
3535

36-
static int restart_poweroff_remove(struct platform_device *pdev)
36+
static void restart_poweroff_remove(struct platform_device *pdev)
3737
{
3838
if (pm_power_off == &restart_poweroff_do_poweroff)
3939
pm_power_off = NULL;
40-
41-
return 0;
4240
}
4341

4442
static const struct of_device_id of_restart_poweroff_match[] = {
@@ -49,7 +47,7 @@ MODULE_DEVICE_TABLE(of, of_restart_poweroff_match);
4947

5048
static struct platform_driver restart_poweroff_driver = {
5149
.probe = restart_poweroff_probe,
52-
.remove = restart_poweroff_remove,
50+
.remove_new = restart_poweroff_remove,
5351
.driver = {
5452
.name = "poweroff-restart",
5553
.of_match_table = of_restart_poweroff_match,

0 commit comments

Comments
 (0)