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

gpio: dln2: 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
6a277ca7 67c811b6

+2 -4
+2 -4
drivers/gpio/gpio-dln2.c
··· 504 504 return 0; 505 505 } 506 506 507 - static int dln2_gpio_remove(struct platform_device *pdev) 507 + static void dln2_gpio_remove(struct platform_device *pdev) 508 508 { 509 509 dln2_unregister_event_cb(pdev, DLN2_GPIO_CONDITION_MET_EV); 510 - 511 - return 0; 512 510 } 513 511 514 512 static struct platform_driver dln2_gpio_driver = { 515 513 .driver.name = "dln2-gpio", 516 514 .probe = dln2_gpio_probe, 517 - .remove = dln2_gpio_remove, 515 + .remove_new = dln2_gpio_remove, 518 516 }; 519 517 520 518 module_platform_driver(dln2_gpio_driver);