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

iio: adc: ti_am335x_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-26-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
e4bd0e60 794c760f

+2 -4
+2 -4
drivers/iio/adc/ti_am335x_adc.c
··· 681 681 return err; 682 682 } 683 683 684 - static int tiadc_remove(struct platform_device *pdev) 684 + static void tiadc_remove(struct platform_device *pdev) 685 685 { 686 686 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 687 687 struct tiadc_device *adc_dev = iio_priv(indio_dev); ··· 697 697 698 698 step_en = get_adc_step_mask(adc_dev); 699 699 am335x_tsc_se_clr(adc_dev->mfd_tscadc, step_en); 700 - 701 - return 0; 702 700 } 703 701 704 702 static int tiadc_suspend(struct device *dev) ··· 745 747 .of_match_table = ti_adc_dt_ids, 746 748 }, 747 749 .probe = tiadc_probe, 748 - .remove = tiadc_remove, 750 + .remove_new = tiadc_remove, 749 751 }; 750 752 module_platform_driver(tiadc_driver); 751 753