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

fsi: master-gpio: 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.

Acked-by: Jeremy Kerr <jk@ozlabs.org>
Link: https://lists.ozlabs.org/pipermail/linux-fsi/2024-March/000612.html
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

+2 -4
+2 -4
drivers/fsi/fsi-master-gpio.c
··· 867 867 868 868 869 869 870 - static int fsi_master_gpio_remove(struct platform_device *pdev) 870 + static void fsi_master_gpio_remove(struct platform_device *pdev) 871 871 { 872 872 struct fsi_master_gpio *master = platform_get_drvdata(pdev); 873 873 874 874 device_remove_file(&pdev->dev, &dev_attr_external_mode); 875 875 876 876 fsi_master_unregister(&master->master); 877 - 878 - return 0; 879 877 } 880 878 881 879 static const struct of_device_id fsi_master_gpio_match[] = { ··· 888 890 .of_match_table = fsi_master_gpio_match, 889 891 }, 890 892 .probe = fsi_master_gpio_probe, 891 - .remove = fsi_master_gpio_remove, 893 + .remove_new = fsi_master_gpio_remove, 892 894 }; 893 895 894 896 module_platform_driver(fsi_master_gpio_driver);