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

bus: hisi_lpc: 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.

Link: https://lore.kernel.org/r/20231109202830.4124591-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

+2 -4
+2 -4
drivers/bus/hisi_lpc.c
··· 657 657 return ret; 658 658 } 659 659 660 - static int hisi_lpc_remove(struct platform_device *pdev) 660 + static void hisi_lpc_remove(struct platform_device *pdev) 661 661 { 662 662 struct device *dev = &pdev->dev; 663 663 struct hisi_lpc_dev *lpcdev = dev_get_drvdata(dev); ··· 669 669 of_platform_depopulate(dev); 670 670 671 671 logic_pio_unregister_range(range); 672 - 673 - return 0; 674 672 } 675 673 676 674 static const struct of_device_id hisi_lpc_of_match[] = { ··· 689 691 .acpi_match_table = hisi_lpc_acpi_match, 690 692 }, 691 693 .probe = hisi_lpc_probe, 692 - .remove = hisi_lpc_remove, 694 + .remove_new = hisi_lpc_remove, 693 695 }; 694 696 builtin_platform_driver(hisi_lpc_driver);