Message ID | 20230517230239.187727-15-u.kleine-koenig@pengutronix.de (mailing list archive) |
---|---|
State | Accepted |
Commit | 8257d5f548d6212e62a6d4230a04a5db6d01b487 |
Headers | show |
Series | usb: Convert to platform remove callback returning void | expand |
On Thu, May 18, 2023, Uwe Kleine-König wrote: > 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> > --- > drivers/usb/dwc3/dwc3-exynos.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c > index 4be6a873bd07..f882dd647340 100644 > --- a/drivers/usb/dwc3/dwc3-exynos.c > +++ b/drivers/usb/dwc3/dwc3-exynos.c > @@ -128,7 +128,7 @@ static int dwc3_exynos_probe(struct platform_device *pdev) > return ret; > } > > -static int dwc3_exynos_remove(struct platform_device *pdev) > +static void dwc3_exynos_remove(struct platform_device *pdev) > { > struct dwc3_exynos *exynos = platform_get_drvdata(pdev); > int i; > @@ -143,8 +143,6 @@ static int dwc3_exynos_remove(struct platform_device *pdev) > > regulator_disable(exynos->vdd33); > regulator_disable(exynos->vdd10); > - > - return 0; > } > > static const struct dwc3_exynos_driverdata exynos5250_drvdata = { > @@ -234,7 +232,7 @@ static const struct dev_pm_ops dwc3_exynos_dev_pm_ops = { > > static struct platform_driver dwc3_exynos_driver = { > .probe = dwc3_exynos_probe, > - .remove = dwc3_exynos_remove, > + .remove_new = dwc3_exynos_remove, > .driver = { > .name = "exynos-dwc3", > .of_match_table = exynos_dwc3_match, > -- > 2.39.2 > Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Thanks, Thinh
diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index 4be6a873bd07..f882dd647340 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c @@ -128,7 +128,7 @@ static int dwc3_exynos_probe(struct platform_device *pdev) return ret; } -static int dwc3_exynos_remove(struct platform_device *pdev) +static void dwc3_exynos_remove(struct platform_device *pdev) { struct dwc3_exynos *exynos = platform_get_drvdata(pdev); int i; @@ -143,8 +143,6 @@ static int dwc3_exynos_remove(struct platform_device *pdev) regulator_disable(exynos->vdd33); regulator_disable(exynos->vdd10); - - return 0; } static const struct dwc3_exynos_driverdata exynos5250_drvdata = { @@ -234,7 +232,7 @@ static const struct dev_pm_ops dwc3_exynos_dev_pm_ops = { static struct platform_driver dwc3_exynos_driver = { .probe = dwc3_exynos_probe, - .remove = dwc3_exynos_remove, + .remove_new = dwc3_exynos_remove, .driver = { .name = "exynos-dwc3", .of_match_table = exynos_dwc3_match,
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> --- drivers/usb/dwc3/dwc3-exynos.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)