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

gpio: mpc5200: 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
0ede8698 4f5c7bc1

+3 -5
+3 -5
drivers/gpio/gpio-mpc5200.c
··· 165 165 return 0; 166 166 } 167 167 168 - static int mpc52xx_gpiochip_remove(struct platform_device *ofdev) 168 + static void mpc52xx_gpiochip_remove(struct platform_device *ofdev) 169 169 { 170 170 struct mpc52xx_gpiochip *chip = platform_get_drvdata(ofdev); 171 171 172 172 of_mm_gpiochip_remove(&chip->mmchip); 173 - 174 - return 0; 175 173 } 176 174 177 175 static const struct of_device_id mpc52xx_wkup_gpiochip_match[] = { ··· 183 185 .of_match_table = mpc52xx_wkup_gpiochip_match, 184 186 }, 185 187 .probe = mpc52xx_wkup_gpiochip_probe, 186 - .remove = mpc52xx_gpiochip_remove, 188 + .remove_new = mpc52xx_gpiochip_remove, 187 189 }; 188 190 189 191 /* ··· 336 338 .of_match_table = mpc52xx_simple_gpiochip_match, 337 339 }, 338 340 .probe = mpc52xx_simple_gpiochip_probe, 339 - .remove = mpc52xx_gpiochip_remove, 341 + .remove_new = mpc52xx_gpiochip_remove, 340 342 }; 341 343 342 344 static struct platform_driver * const drivers[] = {