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

gpio: mm-lantiq: 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
4f5c7bc1 e86c4f1c

+2 -4
+2 -4
drivers/gpio/gpio-mm-lantiq.c
··· 121 121 return of_mm_gpiochip_add_data(pdev->dev.of_node, &chip->mmchip, chip); 122 122 } 123 123 124 - static int ltq_mm_remove(struct platform_device *pdev) 124 + static void ltq_mm_remove(struct platform_device *pdev) 125 125 { 126 126 struct ltq_mm *chip = platform_get_drvdata(pdev); 127 127 128 128 of_mm_gpiochip_remove(&chip->mmchip); 129 - 130 - return 0; 131 129 } 132 130 133 131 static const struct of_device_id ltq_mm_match[] = { ··· 136 138 137 139 static struct platform_driver ltq_mm_driver = { 138 140 .probe = ltq_mm_probe, 139 - .remove = ltq_mm_remove, 141 + .remove_new = ltq_mm_remove, 140 142 .driver = { 141 143 .name = "gpio-mm-ltq", 142 144 .of_match_table = ltq_mm_match,