The driver needs to cleanup the resources if an error occurred. Otherwise,
on deferred probing, it will fail to take the resources for a second time.

Signed-off-by: Michael Grzeschik <[email protected]>
---
v1 -> v2: fixed missing change of release_region tag for phy_init error

 drivers/usb/dwc2/dwc2.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/dwc2/dwc2.c b/drivers/usb/dwc2/dwc2.c
index bd33334a83..82b5ef2813 100644
--- a/drivers/usb/dwc2/dwc2.c
+++ b/drivers/usb/dwc2/dwc2.c
@@ -53,12 +53,12 @@ static int dwc2_probe(struct device_d *dev)
        dwc2->phy = phy_optional_get(dev, "usb2-phy");
        if (IS_ERR(dwc2->phy)) {
                ret = PTR_ERR(dwc2->phy);
-               return ret;
+               goto release_region;
        }
 
        ret = phy_init(dwc2->phy);
        if (ret)
-               goto err_phy_init;
+               goto release_region;
        ret = phy_power_on(dwc2->phy);
        if (ret)
                goto err_phy_power;
@@ -100,7 +100,8 @@ error:
        phy_power_off(dwc2->phy);
 err_phy_power:
        phy_exit(dwc2->phy);
-err_phy_init:
+release_region:
+       release_region(iores);
 
        return ret;
 }
-- 
2.29.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to