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

iio: adc: stm32-dfsdm-adc: 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-23-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
cd918e75 da8431b4

+2 -4
+2 -4
drivers/iio/adc/stm32-dfsdm-adc.c
··· 1620 1620 return ret; 1621 1621 } 1622 1622 1623 - static int stm32_dfsdm_adc_remove(struct platform_device *pdev) 1623 + static void stm32_dfsdm_adc_remove(struct platform_device *pdev) 1624 1624 { 1625 1625 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 1626 1626 struct stm32_dfsdm_adc *adc = iio_priv(indio_dev); ··· 1629 1629 of_platform_depopulate(&pdev->dev); 1630 1630 iio_device_unregister(indio_dev); 1631 1631 stm32_dfsdm_dma_release(indio_dev); 1632 - 1633 - return 0; 1634 1632 } 1635 1633 1636 1634 static int stm32_dfsdm_adc_suspend(struct device *dev) ··· 1675 1677 .pm = pm_sleep_ptr(&stm32_dfsdm_adc_pm_ops), 1676 1678 }, 1677 1679 .probe = stm32_dfsdm_adc_probe, 1678 - .remove = stm32_dfsdm_adc_remove, 1680 + .remove_new = stm32_dfsdm_adc_remove, 1679 1681 }; 1680 1682 module_platform_driver(stm32_dfsdm_adc_driver); 1681 1683