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

iio: dac: stm32-dac-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-32-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
b5821e60 b4785a25

+2 -4
+2 -4
drivers/iio/dac/stm32-dac-core.c
··· 183 183 return ret; 184 184 } 185 185 186 - static int stm32_dac_remove(struct platform_device *pdev) 186 + static void stm32_dac_remove(struct platform_device *pdev) 187 187 { 188 188 pm_runtime_get_sync(&pdev->dev); 189 189 of_platform_depopulate(&pdev->dev); ··· 191 191 pm_runtime_disable(&pdev->dev); 192 192 pm_runtime_set_suspended(&pdev->dev); 193 193 pm_runtime_put_noidle(&pdev->dev); 194 - 195 - return 0; 196 194 } 197 195 198 196 static int stm32_dac_core_resume(struct device *dev) ··· 247 249 248 250 static struct platform_driver stm32_dac_driver = { 249 251 .probe = stm32_dac_probe, 250 - .remove = stm32_dac_remove, 252 + .remove_new = stm32_dac_remove, 251 253 .driver = { 252 254 .name = "stm32-dac-core", 253 255 .of_match_table = stm32_dac_of_match,