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

usb: phy: gpio-vbus: 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 (mostly) ignored
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.

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/20230319092428.283054-6-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
399d0117 a8095f9c

+2 -4
+2 -4
drivers/usb/phy/phy-gpio-vbus-usb.c
··· 325 325 return 0; 326 326 } 327 327 328 - static int gpio_vbus_remove(struct platform_device *pdev) 328 + static void gpio_vbus_remove(struct platform_device *pdev) 329 329 { 330 330 struct gpio_vbus_data *gpio_vbus = platform_get_drvdata(pdev); 331 331 ··· 333 333 cancel_delayed_work_sync(&gpio_vbus->work); 334 334 335 335 usb_remove_phy(&gpio_vbus->phy); 336 - 337 - return 0; 338 336 } 339 337 340 338 #ifdef CONFIG_PM ··· 384 386 .of_match_table = gpio_vbus_of_match, 385 387 }, 386 388 .probe = gpio_vbus_probe, 387 - .remove = gpio_vbus_remove, 389 + .remove_new = gpio_vbus_remove, 388 390 }; 389 391 390 392 module_platform_driver(gpio_vbus_driver);