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

iio: adc: axp20x: 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-6-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
5ff1f754 3624d5fd

+2 -4
+2 -4
drivers/iio/adc/axp20x_adc.c
··· 745 745 return ret; 746 746 } 747 747 748 - static int axp20x_remove(struct platform_device *pdev) 748 + static void axp20x_remove(struct platform_device *pdev) 749 749 { 750 750 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 751 751 struct axp20x_adc_iio *info = iio_priv(indio_dev); ··· 757 757 758 758 if (info->data->adc_en2_mask) 759 759 regmap_write(info->regmap, AXP20X_ADC_EN2, 0); 760 - 761 - return 0; 762 760 } 763 761 764 762 static struct platform_driver axp20x_adc_driver = { ··· 766 768 }, 767 769 .id_table = axp20x_adc_id_match, 768 770 .probe = axp20x_probe, 769 - .remove = axp20x_remove, 771 + .remove_new = axp20x_remove, 770 772 }; 771 773 772 774 module_platform_driver(axp20x_adc_driver);