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

hwmon: (f71882fg) 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-8-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
a8f208d2 f79fe155

+2 -3
+2 -3
drivers/hwmon/f71882fg.c
··· 2223 2223 return err; 2224 2224 } 2225 2225 2226 - static int f71882fg_remove(struct platform_device *pdev) 2226 + static void f71882fg_remove(struct platform_device *pdev) 2227 2227 { 2228 2228 struct f71882fg_data *data = platform_get_drvdata(pdev); 2229 2229 int nr_fans = f71882fg_nr_fans[data->type]; ··· 2333 2333 ARRAY_SIZE(fxxxx_auto_pwm_attr[0]) * nr_fans); 2334 2334 } 2335 2335 } 2336 - return 0; 2337 2336 } 2338 2337 2339 2338 static int f71882fg_probe(struct platform_device *pdev) ··· 2658 2659 .name = DRVNAME, 2659 2660 }, 2660 2661 .probe = f71882fg_probe, 2661 - .remove = f71882fg_remove, 2662 + .remove_new = f71882fg_remove, 2662 2663 }; 2663 2664 2664 2665 static int __init f71882fg_init(void)