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

usb: fotg210: 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: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230517230239.187727-24-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
2c16f04d 5b3eb973

+2 -4
+2 -4
drivers/usb/fotg210/fotg210-core.c
··· 165 165 return ret; 166 166 } 167 167 168 - static int fotg210_remove(struct platform_device *pdev) 168 + static void fotg210_remove(struct platform_device *pdev) 169 169 { 170 170 struct device *dev = &pdev->dev; 171 171 enum usb_dr_mode mode; ··· 176 176 fotg210_udc_remove(pdev); 177 177 else 178 178 fotg210_hcd_remove(pdev); 179 - 180 - return 0; 181 179 } 182 180 183 181 #ifdef CONFIG_OF ··· 194 196 .of_match_table = of_match_ptr(fotg210_of_match), 195 197 }, 196 198 .probe = fotg210_probe, 197 - .remove = fotg210_remove, 199 + .remove_new = fotg210_remove, 198 200 }; 199 201 200 202 static int __init fotg210_init(void)