Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Uwe Kleine-König and committed by
Sebastian Reichel
6642b132 6f539f31

+2 -3
+2 -3
drivers/power/reset/ltc2952-poweroff.c
··· 286 286 return 0; 287 287 } 288 288 289 - static int ltc2952_poweroff_remove(struct platform_device *pdev) 289 + static void ltc2952_poweroff_remove(struct platform_device *pdev) 290 290 { 291 291 struct ltc2952_poweroff *data = platform_get_drvdata(pdev); 292 292 ··· 295 295 hrtimer_cancel(&data->timer_wde); 296 296 atomic_notifier_chain_unregister(&panic_notifier_list, 297 297 &data->panic_notifier); 298 - return 0; 299 298 } 300 299 301 300 static const struct of_device_id of_ltc2952_poweroff_match[] = { ··· 305 306 306 307 static struct platform_driver ltc2952_poweroff_driver = { 307 308 .probe = ltc2952_poweroff_probe, 308 - .remove = ltc2952_poweroff_remove, 309 + .remove_new = ltc2952_poweroff_remove, 309 310 .driver = { 310 311 .name = "ltc2952-poweroff", 311 312 .of_match_table = of_ltc2952_poweroff_match,