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

iio: adc: ab8500-gpadc: 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-3-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
9cb1bcd4 53cb25c9

+2 -4
+2 -4
drivers/iio/adc/ab8500-gpadc.c
··· 1179 1179 return ret; 1180 1180 } 1181 1181 1182 - static int ab8500_gpadc_remove(struct platform_device *pdev) 1182 + static void ab8500_gpadc_remove(struct platform_device *pdev) 1183 1183 { 1184 1184 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 1185 1185 struct ab8500_gpadc *gpadc = iio_priv(indio_dev); ··· 1188 1188 pm_runtime_put_noidle(gpadc->dev); 1189 1189 pm_runtime_disable(gpadc->dev); 1190 1190 regulator_disable(gpadc->vddadc); 1191 - 1192 - return 0; 1193 1191 } 1194 1192 1195 1193 static DEFINE_RUNTIME_DEV_PM_OPS(ab8500_gpadc_pm_ops, ··· 1196 1198 1197 1199 static struct platform_driver ab8500_gpadc_driver = { 1198 1200 .probe = ab8500_gpadc_probe, 1199 - .remove = ab8500_gpadc_remove, 1201 + .remove_new = ab8500_gpadc_remove, 1200 1202 .driver = { 1201 1203 .name = "ab8500-gpadc", 1202 1204 .pm = pm_ptr(&ab8500_gpadc_pm_ops),