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

iio: dac: stm32-dac: 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-33-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
85a32a0a b5821e60

+2 -4
+2 -4
drivers/iio/dac/stm32-dac.c
··· 362 362 return ret; 363 363 } 364 364 365 - static int stm32_dac_remove(struct platform_device *pdev) 365 + static void stm32_dac_remove(struct platform_device *pdev) 366 366 { 367 367 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 368 368 ··· 371 371 pm_runtime_disable(&pdev->dev); 372 372 pm_runtime_set_suspended(&pdev->dev); 373 373 pm_runtime_put_noidle(&pdev->dev); 374 - 375 - return 0; 376 374 } 377 375 378 376 static int stm32_dac_suspend(struct device *dev) ··· 398 400 399 401 static struct platform_driver stm32_dac_driver = { 400 402 .probe = stm32_dac_probe, 401 - .remove = stm32_dac_remove, 403 + .remove_new = stm32_dac_remove, 402 404 .driver = { 403 405 .name = "stm32-dac", 404 406 .of_match_table = stm32_dac_of_match,