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

usb: cdns3: starfive: 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>
Acked-by: Roger Quadros <rogerq@kernel.org>
Link: https://lore.kernel.org/r/20230707073653.3396988-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Uwe Kleine-König and committed by
Greg Kroah-Hartman
48cb8ff3 2f409229

+2 -4
+2 -4
drivers/usb/cdns3/cdns3-starfive.c
··· 166 166 return 0; 167 167 } 168 168 169 - static int cdns_starfive_remove(struct platform_device *pdev) 169 + static void cdns_starfive_remove(struct platform_device *pdev) 170 170 { 171 171 struct device *dev = &pdev->dev; 172 172 struct cdns_starfive *data = dev_get_drvdata(dev); ··· 178 178 pm_runtime_put_noidle(dev); 179 179 cdns_clk_rst_deinit(data); 180 180 platform_set_drvdata(pdev, NULL); 181 - 182 - return 0; 183 181 } 184 182 185 183 #ifdef CONFIG_PM ··· 230 232 231 233 static struct platform_driver cdns_starfive_driver = { 232 234 .probe = cdns_starfive_probe, 233 - .remove = cdns_starfive_remove, 235 + .remove_new = cdns_starfive_remove, 234 236 .driver = { 235 237 .name = "cdns3-starfive", 236 238 .of_match_table = cdns_starfive_of_match,