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

power: supply: max77650-charger: 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() is 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/20230918133700.1254499-19-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
cd25ac3e 81e487b8

+2 -4
+2 -4
drivers/power/supply/max77650-charger.c
··· 345 345 return max77650_charger_enable(chg); 346 346 } 347 347 348 - static int max77650_charger_remove(struct platform_device *pdev) 348 + static void max77650_charger_remove(struct platform_device *pdev) 349 349 { 350 350 struct max77650_charger_data *chg = platform_get_drvdata(pdev); 351 351 352 352 max77650_charger_disable(chg); 353 - 354 - return 0; 355 353 } 356 354 357 355 static const struct of_device_id max77650_charger_of_match[] = { ··· 364 366 .of_match_table = max77650_charger_of_match, 365 367 }, 366 368 .probe = max77650_charger_probe, 367 - .remove = max77650_charger_remove, 369 + .remove_new = max77650_charger_remove, 368 370 }; 369 371 module_platform_driver(max77650_charger_driver); 370 372