Skip to content

Commit 6642b13

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

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/power/reset/ltc2952-poweroff.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ static int ltc2952_poweroff_probe(struct platform_device *pdev)
286286
return 0;
287287
}
288288

289-
static int ltc2952_poweroff_remove(struct platform_device *pdev)
289+
static void ltc2952_poweroff_remove(struct platform_device *pdev)
290290
{
291291
struct ltc2952_poweroff *data = platform_get_drvdata(pdev);
292292

@@ -295,7 +295,6 @@ static int ltc2952_poweroff_remove(struct platform_device *pdev)
295295
hrtimer_cancel(&data->timer_wde);
296296
atomic_notifier_chain_unregister(&panic_notifier_list,
297297
&data->panic_notifier);
298-
return 0;
299298
}
300299

301300
static const struct of_device_id of_ltc2952_poweroff_match[] = {
@@ -306,7 +305,7 @@ MODULE_DEVICE_TABLE(of, of_ltc2952_poweroff_match);
306305

307306
static struct platform_driver ltc2952_poweroff_driver = {
308307
.probe = ltc2952_poweroff_probe,
309-
.remove = ltc2952_poweroff_remove,
308+
.remove_new = ltc2952_poweroff_remove,
310309
.driver = {
311310
.name = "ltc2952-poweroff",
312311
.of_match_table = of_ltc2952_poweroff_match,

0 commit comments

Comments
 (0)