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

iio: dac: vf610: 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-34-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
cf22fc55 85a32a0a

+2 -4
+2 -4
drivers/iio/dac/vf610_dac.c
··· 231 231 return ret; 232 232 } 233 233 234 - static int vf610_dac_remove(struct platform_device *pdev) 234 + static void vf610_dac_remove(struct platform_device *pdev) 235 235 { 236 236 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 237 237 struct vf610_dac *info = iio_priv(indio_dev); ··· 239 239 iio_device_unregister(indio_dev); 240 240 vf610_dac_exit(info); 241 241 clk_disable_unprepare(info->clk); 242 - 243 - return 0; 244 242 } 245 243 246 244 static int vf610_dac_suspend(struct device *dev) ··· 272 274 273 275 static struct platform_driver vf610_dac_driver = { 274 276 .probe = vf610_dac_probe, 275 - .remove = vf610_dac_remove, 277 + .remove_new = vf610_dac_remove, 276 278 .driver = { 277 279 .name = "vf610-dac", 278 280 .of_match_table = vf610_dac_match,