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

gpio: zynq: 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: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Uwe Kleine-König and committed by
Bartosz Golaszewski
8c755328 4f7b5eed

+2 -3
+2 -3
drivers/gpio/gpio-zynq.c
··· 1010 1010 * 1011 1011 * Return: 0 always 1012 1012 */ 1013 - static int zynq_gpio_remove(struct platform_device *pdev) 1013 + static void zynq_gpio_remove(struct platform_device *pdev) 1014 1014 { 1015 1015 struct zynq_gpio *gpio = platform_get_drvdata(pdev); 1016 1016 int ret; ··· 1022 1022 clk_disable_unprepare(gpio->clk); 1023 1023 device_set_wakeup_capable(&pdev->dev, 0); 1024 1024 pm_runtime_disable(&pdev->dev); 1025 - return 0; 1026 1025 } 1027 1026 1028 1027 static struct platform_driver zynq_gpio_driver = { ··· 1031 1032 .of_match_table = zynq_gpio_of_match, 1032 1033 }, 1033 1034 .probe = zynq_gpio_probe, 1034 - .remove = zynq_gpio_remove, 1035 + .remove_new = zynq_gpio_remove, 1035 1036 }; 1036 1037 1037 1038 module_platform_driver(zynq_gpio_driver);