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

gpio: ljca: 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
da2ad5fe b6c43915

+2 -3
+2 -3
drivers/gpio/gpio-ljca.c
··· 421 421 return ret; 422 422 } 423 423 424 - static int ljca_gpio_remove(struct platform_device *pdev) 424 + static void ljca_gpio_remove(struct platform_device *pdev) 425 425 { 426 426 struct ljca_gpio_dev *ljca_gpio = platform_get_drvdata(pdev); 427 427 ··· 429 429 ljca_unregister_event_cb(ljca_gpio->gpio_info->ljca); 430 430 mutex_destroy(&ljca_gpio->irq_lock); 431 431 mutex_destroy(&ljca_gpio->trans_lock); 432 - return 0; 433 432 } 434 433 435 434 #define LJCA_GPIO_DRV_NAME "ljca-gpio" ··· 441 442 static struct platform_driver ljca_gpio_driver = { 442 443 .driver.name = LJCA_GPIO_DRV_NAME, 443 444 .probe = ljca_gpio_probe, 444 - .remove = ljca_gpio_remove, 445 + .remove_new = ljca_gpio_remove, 445 446 }; 446 447 module_platform_driver(ljca_gpio_driver); 447 448