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

hwmon: (w83627hf) 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() is 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/20230918085951.1234172-23-u.kleine-koenig@pengutronix.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Uwe Kleine-König and committed by
Guenter Roeck
eaac830a 5b400006

+2 -4
+2 -4
drivers/hwmon/w83627hf.c
··· 1828 1828 return err; 1829 1829 } 1830 1830 1831 - static int w83627hf_remove(struct platform_device *pdev) 1831 + static void w83627hf_remove(struct platform_device *pdev) 1832 1832 { 1833 1833 struct w83627hf_data *data = platform_get_drvdata(pdev); 1834 1834 ··· 1836 1836 1837 1837 sysfs_remove_group(&pdev->dev.kobj, &w83627hf_group); 1838 1838 sysfs_remove_group(&pdev->dev.kobj, &w83627hf_group_opt); 1839 - 1840 - return 0; 1841 1839 } 1842 1840 1843 1841 static struct platform_driver w83627hf_driver = { ··· 1844 1846 .pm = W83627HF_DEV_PM_OPS, 1845 1847 }, 1846 1848 .probe = w83627hf_probe, 1847 - .remove = w83627hf_remove, 1849 + .remove_new = w83627hf_remove, 1848 1850 }; 1849 1851 1850 1852 static int __init w83627hf_find(int sioaddr, unsigned short *addr,