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

hwmon: (abituguru3) 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-4-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
f23e7597 68d66551

+2 -3
+2 -3
drivers/hwmon/abituguru3.c
··· 1061 1061 return res; 1062 1062 } 1063 1063 1064 - static int abituguru3_remove(struct platform_device *pdev) 1064 + static void abituguru3_remove(struct platform_device *pdev) 1065 1065 { 1066 1066 int i; 1067 1067 struct abituguru3_data *data = platform_get_drvdata(pdev); ··· 1072 1072 for (i = 0; i < ARRAY_SIZE(abituguru3_sysfs_attr); i++) 1073 1073 device_remove_file(&pdev->dev, 1074 1074 &abituguru3_sysfs_attr[i].dev_attr); 1075 - return 0; 1076 1075 } 1077 1076 1078 1077 static struct abituguru3_data *abituguru3_update_device(struct device *dev) ··· 1152 1153 .pm = pm_sleep_ptr(&abituguru3_pm), 1153 1154 }, 1154 1155 .probe = abituguru3_probe, 1155 - .remove = abituguru3_remove, 1156 + .remove_new = abituguru3_remove, 1156 1157 }; 1157 1158 1158 1159 static int __init abituguru3_dmi_detect(void)