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

iio: adc: at91: 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-5-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
3624d5fd e5e92308

+2 -4
+2 -4
drivers/iio/adc/at91_adc.c
··· 1185 1185 return ret; 1186 1186 } 1187 1187 1188 - static int at91_adc_remove(struct platform_device *pdev) 1188 + static void at91_adc_remove(struct platform_device *pdev) 1189 1189 { 1190 1190 struct iio_dev *idev = platform_get_drvdata(pdev); 1191 1191 struct at91_adc_state *st = iio_priv(idev); ··· 1197 1197 } else { 1198 1198 at91_ts_unregister(st); 1199 1199 } 1200 - 1201 - return 0; 1202 1200 } 1203 1201 1204 1202 static int at91_adc_suspend(struct device *dev) ··· 1346 1348 1347 1349 static struct platform_driver at91_adc_driver = { 1348 1350 .probe = at91_adc_probe, 1349 - .remove = at91_adc_remove, 1351 + .remove_new = at91_adc_remove, 1350 1352 .driver = { 1351 1353 .name = DRIVER_NAME, 1352 1354 .of_match_table = at91_adc_dt_ids,