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

hwmon: (aspeed-g6-pwm-tach) 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>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Link: https://lore.kernel.org/r/20240409085552.19868-2-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
e27cbb60 b20b040c

+2 -4
+2 -4
drivers/hwmon/aspeed-g6-pwm-tach.c
··· 516 516 return 0; 517 517 } 518 518 519 - static int aspeed_pwm_tach_remove(struct platform_device *pdev) 519 + static void aspeed_pwm_tach_remove(struct platform_device *pdev) 520 520 { 521 521 struct aspeed_pwm_tach_data *priv = platform_get_drvdata(pdev); 522 522 523 523 reset_control_assert(priv->reset); 524 - 525 - return 0; 526 524 } 527 525 528 526 static const struct of_device_id aspeed_pwm_tach_match[] = { ··· 533 535 534 536 static struct platform_driver aspeed_pwm_tach_driver = { 535 537 .probe = aspeed_pwm_tach_probe, 536 - .remove = aspeed_pwm_tach_remove, 538 + .remove_new = aspeed_pwm_tach_remove, 537 539 .driver = { 538 540 .name = "aspeed-g6-pwm-tach", 539 541 .of_match_table = aspeed_pwm_tach_match,