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

gpio: ts5500: 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
a2e09217 12305969

+2 -4
+2 -4
drivers/gpio/gpio-ts5500.c
··· 412 412 return 0; 413 413 } 414 414 415 - static int ts5500_dio_remove(struct platform_device *pdev) 415 + static void ts5500_dio_remove(struct platform_device *pdev) 416 416 { 417 417 struct ts5500_priv *priv = platform_get_drvdata(pdev); 418 418 419 419 ts5500_disable_irq(priv); 420 - 421 - return 0; 422 420 } 423 421 424 422 static const struct platform_device_id ts5500_dio_ids[] = { ··· 433 435 .name = "ts5500-dio", 434 436 }, 435 437 .probe = ts5500_dio_probe, 436 - .remove = ts5500_dio_remove, 438 + .remove_new = ts5500_dio_remove, 437 439 .id_table = ts5500_dio_ids, 438 440 }; 439 441