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

usb: phy: twl6030: 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>
Link: https://lore.kernel.org/r/20230319092428.283054-12-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
17eb8190 d95a0ce2

+2 -4
+2 -4
drivers/usb/phy/phy-twl6030-usb.c
··· 409 409 return status; 410 410 } 411 411 412 - static int twl6030_usb_remove(struct platform_device *pdev) 412 + static void twl6030_usb_remove(struct platform_device *pdev) 413 413 { 414 414 struct twl6030_usb *twl = platform_get_drvdata(pdev); 415 415 ··· 422 422 free_irq(twl->irq2, twl); 423 423 regulator_put(twl->usb3v3); 424 424 cancel_work_sync(&twl->set_vbus_work); 425 - 426 - return 0; 427 425 } 428 426 429 427 static const struct of_device_id twl6030_usb_id_table[] = { ··· 432 434 433 435 static struct platform_driver twl6030_usb_driver = { 434 436 .probe = twl6030_usb_probe, 435 - .remove = twl6030_usb_remove, 437 + .remove_new = twl6030_usb_remove, 436 438 .driver = { 437 439 .name = "twl6030_usb", 438 440 .of_match_table = of_match_ptr(twl6030_usb_id_table),