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

power: supply: max77693_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-20-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
1d138270 cd25ac3e

+2 -4
+2 -4
drivers/power/supply/max77693_charger.c
··· 728 728 return ret; 729 729 } 730 730 731 - static int max77693_charger_remove(struct platform_device *pdev) 731 + static void max77693_charger_remove(struct platform_device *pdev) 732 732 { 733 733 struct max77693_charger *chg = platform_get_drvdata(pdev); 734 734 ··· 737 737 device_remove_file(&pdev->dev, &dev_attr_fast_charge_timer); 738 738 739 739 power_supply_unregister(chg->charger); 740 - 741 - return 0; 742 740 } 743 741 744 742 static const struct platform_device_id max77693_charger_id[] = { ··· 750 752 .name = "max77693-charger", 751 753 }, 752 754 .probe = max77693_charger_probe, 753 - .remove = max77693_charger_remove, 755 + .remove_new = max77693_charger_remove, 754 756 .id_table = max77693_charger_id, 755 757 }; 756 758 module_platform_driver(max77693_charger_driver);