usb: xhci-histb: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 30 May 2023 07:19:09 +0000 (09:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 May 2023 14:27:17 +0000 (15:27 +0100)
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/20230530071913.2192214-3-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-histb.c

index 91ce97821de5180d62b9685f575b6b23a1fdbf15..d8aba07e802da73b89ff8948a376d6e3c0a42063 100644 (file)
@@ -319,7 +319,7 @@ disable_pm:
        return ret;
 }
 
-static int xhci_histb_remove(struct platform_device *dev)
+static void xhci_histb_remove(struct platform_device *dev)
 {
        struct xhci_hcd_histb *histb = platform_get_drvdata(dev);
        struct usb_hcd *hcd = histb->hcd;
@@ -339,8 +339,6 @@ static int xhci_histb_remove(struct platform_device *dev)
        usb_put_hcd(hcd);
        pm_runtime_put_sync(&dev->dev);
        pm_runtime_disable(&dev->dev);
-
-       return 0;
 }
 
 static int __maybe_unused xhci_histb_suspend(struct device *dev)
@@ -385,7 +383,7 @@ MODULE_DEVICE_TABLE(of, histb_xhci_of_match);
 
 static struct platform_driver histb_xhci_driver = {
        .probe  = xhci_histb_probe,
-       .remove = xhci_histb_remove,
+       .remove_new = xhci_histb_remove,
        .driver = {
                .name = "xhci-histb",
                .pm = DEV_PM_OPS,