OSDN Git Service

phy: broadcom: phy-brcm-usb: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 7 Mar 2023 11:58:31 +0000 (12:58 +0100)
committerVinod Koul <vkoul@kernel.org>
Mon, 20 Mar 2023 12:44:56 +0000 (18:14 +0530)
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>
Reviewed-by: Justin Chen <justinpopo6@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20230307115900.2293120-3-u.kleine-koenig@pengutronix.de
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/broadcom/phy-brcm-usb.c

index 4de3999..a4cfb77 100644 (file)
@@ -572,14 +572,12 @@ static int brcm_usb_phy_probe(struct platform_device *pdev)
        return PTR_ERR_OR_ZERO(phy_provider);
 }
 
-static int brcm_usb_phy_remove(struct platform_device *pdev)
+static void brcm_usb_phy_remove(struct platform_device *pdev)
 {
        struct brcm_usb_phy_data *priv = dev_get_drvdata(&pdev->dev);
 
        sysfs_remove_group(&pdev->dev.kobj, &brcm_usb_phy_group);
        unregister_pm_notifier(&priv->pm_notifier);
-
-       return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -670,7 +668,7 @@ MODULE_DEVICE_TABLE(of, brcm_usb_dt_ids);
 
 static struct platform_driver brcm_usb_driver = {
        .probe          = brcm_usb_phy_probe,
-       .remove         = brcm_usb_phy_remove,
+       .remove_new     = brcm_usb_phy_remove,
        .driver         = {
                .name   = "brcmstb-usb-phy",
                .pm = &brcm_usb_phy_pm_ops,