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

gpio: amdpt: 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
484b3226 2ae6a45f

+2 -4
+2 -4
drivers/gpio/gpio-amdpt.c
··· 122 122 return ret; 123 123 } 124 124 125 - static int pt_gpio_remove(struct platform_device *pdev) 125 + static void pt_gpio_remove(struct platform_device *pdev) 126 126 { 127 127 struct pt_gpio_chip *pt_gpio = platform_get_drvdata(pdev); 128 128 129 129 gpiochip_remove(&pt_gpio->gc); 130 - 131 - return 0; 132 130 } 133 131 134 132 static const struct acpi_device_id pt_gpio_acpi_match[] = { ··· 143 145 .acpi_match_table = ACPI_PTR(pt_gpio_acpi_match), 144 146 }, 145 147 .probe = pt_gpio_probe, 146 - .remove = pt_gpio_remove, 148 + .remove_new = pt_gpio_remove, 147 149 }; 148 150 149 151 module_platform_driver(pt_gpio_driver);