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

gpio: cadence: 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
67c811b6 0667faab

+2 -4
+2 -4
drivers/gpio/gpio-cadence.c
··· 268 268 return ret; 269 269 } 270 270 271 - static int cdns_gpio_remove(struct platform_device *pdev) 271 + static void cdns_gpio_remove(struct platform_device *pdev) 272 272 { 273 273 struct cdns_gpio_chip *cgpio = platform_get_drvdata(pdev); 274 274 275 275 iowrite32(cgpio->bypass_orig, cgpio->regs + CDNS_GPIO_BYPASS_MODE); 276 276 clk_disable_unprepare(cgpio->pclk); 277 - 278 - return 0; 279 277 } 280 278 281 279 static const struct of_device_id cdns_of_ids[] = { ··· 288 290 .of_match_table = cdns_of_ids, 289 291 }, 290 292 .probe = cdns_gpio_probe, 291 - .remove = cdns_gpio_remove, 293 + .remove_new = cdns_gpio_remove, 292 294 }; 293 295 module_platform_driver(cdns_gpio_driver); 294 296