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

iio: adc: bcm_iproc: 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>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20230919174931.1417681-7-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
bf7c022b 5ff1f754

+2 -4
+2 -4
drivers/iio/adc/bcm_iproc_adc.c
··· 594 594 return ret; 595 595 } 596 596 597 - static int iproc_adc_remove(struct platform_device *pdev) 597 + static void iproc_adc_remove(struct platform_device *pdev) 598 598 { 599 599 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 600 600 struct iproc_adc_priv *adc_priv = iio_priv(indio_dev); ··· 602 602 iio_device_unregister(indio_dev); 603 603 iproc_adc_disable(indio_dev); 604 604 clk_disable_unprepare(adc_priv->adc_clk); 605 - 606 - return 0; 607 605 } 608 606 609 607 static const struct of_device_id iproc_adc_of_match[] = { ··· 612 614 613 615 static struct platform_driver iproc_adc_driver = { 614 616 .probe = iproc_adc_probe, 615 - .remove = iproc_adc_remove, 617 + .remove_new = iproc_adc_remove, 616 618 .driver = { 617 619 .name = "iproc-static-adc", 618 620 .of_match_table = iproc_adc_of_match,