Skip to content

Commit 6f7be7b

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

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/power/reset/regulator-poweroff.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,10 @@ static int regulator_poweroff_probe(struct platform_device *pdev)
5252
return 0;
5353
}
5454

55-
static int regulator_poweroff_remove(__maybe_unused struct platform_device *pdev)
55+
static void regulator_poweroff_remove(struct platform_device *pdev)
5656
{
5757
if (pm_power_off == &regulator_poweroff_do_poweroff)
5858
pm_power_off = NULL;
59-
60-
return 0;
6159
}
6260

6361
static const struct of_device_id of_regulator_poweroff_match[] = {
@@ -68,7 +66,7 @@ MODULE_DEVICE_TABLE(of, of_regulator_poweroff_match);
6866

6967
static struct platform_driver regulator_poweroff_driver = {
7068
.probe = regulator_poweroff_probe,
71-
.remove = regulator_poweroff_remove,
69+
.remove_new = regulator_poweroff_remove,
7270
.driver = {
7371
.name = "poweroff-regulator",
7472
.of_match_table = of_regulator_poweroff_match,

0 commit comments

Comments
 (0)