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

iio: dac: lpc18xx_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-31-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
b4785a25 3de9b072

+2 -4
+2 -4
drivers/iio/dac/lpc18xx_dac.c
··· 165 165 return ret; 166 166 } 167 167 168 - static int lpc18xx_dac_remove(struct platform_device *pdev) 168 + static void lpc18xx_dac_remove(struct platform_device *pdev) 169 169 { 170 170 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 171 171 struct lpc18xx_dac *dac = iio_priv(indio_dev); ··· 175 175 writel(0, dac->base + LPC18XX_DAC_CTRL); 176 176 clk_disable_unprepare(dac->clk); 177 177 regulator_disable(dac->vref); 178 - 179 - return 0; 180 178 } 181 179 182 180 static const struct of_device_id lpc18xx_dac_match[] = { ··· 185 187 186 188 static struct platform_driver lpc18xx_dac_driver = { 187 189 .probe = lpc18xx_dac_probe, 188 - .remove = lpc18xx_dac_remove, 190 + .remove_new = lpc18xx_dac_remove, 189 191 .driver = { 190 192 .name = "lpc18xx-dac", 191 193 .of_match_table = lpc18xx_dac_match,