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

gpio: mpc8xxx: 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
7a222f57 0ede8698

+2 -4
+2 -4
drivers/gpio/gpio-mpc8xxx.c
··· 419 419 return ret; 420 420 } 421 421 422 - static int mpc8xxx_remove(struct platform_device *pdev) 422 + static void mpc8xxx_remove(struct platform_device *pdev) 423 423 { 424 424 struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev); 425 425 ··· 427 427 irq_set_chained_handler_and_data(mpc8xxx_gc->irqn, NULL, NULL); 428 428 irq_domain_remove(mpc8xxx_gc->irq); 429 429 } 430 - 431 - return 0; 432 430 } 433 431 434 432 #ifdef CONFIG_ACPI ··· 439 441 440 442 static struct platform_driver mpc8xxx_plat_driver = { 441 443 .probe = mpc8xxx_probe, 442 - .remove = mpc8xxx_remove, 444 + .remove_new = mpc8xxx_remove, 443 445 .driver = { 444 446 .name = "gpio-mpc8xxx", 445 447 .of_match_table = mpc8xxx_gpio_ids,