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

gpio: tb10x: 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
7d099290 8c755328

+2 -4
+2 -4
drivers/gpio/gpio-tb10x.c
··· 211 211 return 0; 212 212 } 213 213 214 - static int tb10x_gpio_remove(struct platform_device *pdev) 214 + static void tb10x_gpio_remove(struct platform_device *pdev) 215 215 { 216 216 struct tb10x_gpio *tb10x_gpio = platform_get_drvdata(pdev); 217 217 ··· 221 221 kfree(tb10x_gpio->domain->gc); 222 222 irq_domain_remove(tb10x_gpio->domain); 223 223 } 224 - 225 - return 0; 226 224 } 227 225 228 226 static const struct of_device_id tb10x_gpio_dt_ids[] = { ··· 231 233 232 234 static struct platform_driver tb10x_gpio_driver = { 233 235 .probe = tb10x_gpio_probe, 234 - .remove = tb10x_gpio_remove, 236 + .remove_new = tb10x_gpio_remove, 235 237 .driver = { 236 238 .name = "tb10x-gpio", 237 239 .of_match_table = tb10x_gpio_dt_ids,