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

gpio: lpc18xx: 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
43fdda49 da2ad5fe

+2 -4
+2 -4
drivers/gpio/gpio-lpc18xx.c
··· 381 381 return 0; 382 382 } 383 383 384 - static int lpc18xx_gpio_remove(struct platform_device *pdev) 384 + static void lpc18xx_gpio_remove(struct platform_device *pdev) 385 385 { 386 386 struct lpc18xx_gpio_chip *gc = platform_get_drvdata(pdev); 387 387 ··· 389 389 irq_domain_remove(gc->pin_ic->domain); 390 390 391 391 clk_disable_unprepare(gc->clk); 392 - 393 - return 0; 394 392 } 395 393 396 394 static const struct of_device_id lpc18xx_gpio_match[] = { ··· 399 401 400 402 static struct platform_driver lpc18xx_gpio_driver = { 401 403 .probe = lpc18xx_gpio_probe, 402 - .remove = lpc18xx_gpio_remove, 404 + .remove_new = lpc18xx_gpio_remove, 403 405 .driver = { 404 406 .name = "lpc18xx-gpio", 405 407 .of_match_table = lpc18xx_gpio_match,