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

Input: cros_ec_keyb - 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>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20230920125829.1478827-3-u.kleine-koenig@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Uwe Kleine-König and committed by
Dmitry Torokhov
63ef64cb 18965fcf

+2 -4
+2 -4
drivers/input/keyboard/cros_ec_keyb.c
··· 743 743 return 0; 744 744 } 745 745 746 - static int cros_ec_keyb_remove(struct platform_device *pdev) 746 + static void cros_ec_keyb_remove(struct platform_device *pdev) 747 747 { 748 748 struct cros_ec_keyb *ckdev = dev_get_drvdata(&pdev->dev); 749 749 750 750 blocking_notifier_chain_unregister(&ckdev->ec->event_notifier, 751 751 &ckdev->notifier); 752 - 753 - return 0; 754 752 } 755 753 756 754 #ifdef CONFIG_ACPI ··· 772 774 773 775 static struct platform_driver cros_ec_keyb_driver = { 774 776 .probe = cros_ec_keyb_probe, 775 - .remove = cros_ec_keyb_remove, 777 + .remove_new = cros_ec_keyb_remove, 776 778 .driver = { 777 779 .name = "cros-ec-keyb", 778 780 .dev_groups = cros_ec_keyb_groups,