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

usb: chipidea/ci_hdrc_imx: 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>
Link: https://lore.kernel.org/r/20230517230239.187727-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
ad593ed6 defbfca6

+2 -4
+2 -4
drivers/usb/chipidea/ci_hdrc_imx.c
··· 502 502 return ret; 503 503 } 504 504 505 - static int ci_hdrc_imx_remove(struct platform_device *pdev) 505 + static void ci_hdrc_imx_remove(struct platform_device *pdev) 506 506 { 507 507 struct ci_hdrc_imx_data *data = platform_get_drvdata(pdev); 508 508 ··· 522 522 if (data->hsic_pad_regulator) 523 523 regulator_disable(data->hsic_pad_regulator); 524 524 } 525 - 526 - return 0; 527 525 } 528 526 529 527 static void ci_hdrc_imx_shutdown(struct platform_device *pdev) ··· 648 650 }; 649 651 static struct platform_driver ci_hdrc_imx_driver = { 650 652 .probe = ci_hdrc_imx_probe, 651 - .remove = ci_hdrc_imx_remove, 653 + .remove_new = ci_hdrc_imx_remove, 652 654 .shutdown = ci_hdrc_imx_shutdown, 653 655 .driver = { 654 656 .name = "imx_usb",