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

iio: adc: stm32-dfsdm-core: 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>
Link: https://lore.kernel.org/r/20230919174931.1417681-24-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Uwe Kleine-König and committed by
Jonathan Cameron
259fbaec cd918e75

+2 -4
+2 -4
drivers/iio/adc/stm32-dfsdm-core.c
··· 436 436 return ret; 437 437 } 438 438 439 - static int stm32_dfsdm_core_remove(struct platform_device *pdev) 439 + static void stm32_dfsdm_core_remove(struct platform_device *pdev) 440 440 { 441 441 struct stm32_dfsdm *dfsdm = platform_get_drvdata(pdev); 442 442 ··· 446 446 pm_runtime_set_suspended(&pdev->dev); 447 447 pm_runtime_put_noidle(&pdev->dev); 448 448 stm32_dfsdm_clk_disable_unprepare(dfsdm); 449 - 450 - return 0; 451 449 } 452 450 453 451 static int stm32_dfsdm_core_suspend(struct device *dev) ··· 506 508 507 509 static struct platform_driver stm32_dfsdm_driver = { 508 510 .probe = stm32_dfsdm_probe, 509 - .remove = stm32_dfsdm_core_remove, 511 + .remove_new = stm32_dfsdm_core_remove, 510 512 .driver = { 511 513 .name = "stm32-dfsdm", 512 514 .of_match_table = stm32_dfsdm_of_match,