[U-Boot] [PATCH 4/4] usb: host: ohci-generic: initialize PHY only when found

patrice.chotard at st.com patrice.chotard at st.com
Mon Jul 24 15:07:05 UTC 2017


From: Patrice Chotard <patrice.chotard at st.com>

Call generic_phy_init() only when a PHY was found.
This will avoid a crash if no "phys" property is found in DT.

Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
Reported-by: Patrick Delaunay <patrick.delaunay at st.com>
---
 drivers/usb/host/ohci-generic.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/ohci-generic.c b/drivers/usb/host/ohci-generic.c
index 9249039..e22ee97 100644
--- a/drivers/usb/host/ohci-generic.c
+++ b/drivers/usb/host/ohci-generic.c
@@ -91,12 +91,13 @@ static int ohci_usb_probe(struct udevice *dev)
 			error("failed to get usb phy\n");
 			goto reset_err;
 		}
-	}
+	} else {
 
-	err = generic_phy_init(&priv->phy);
-	if (err) {
-		error("failed to init usb phy\n");
-		goto reset_err;
+		err = generic_phy_init(&priv->phy);
+		if (err) {
+			error("failed to init usb phy\n");
+			goto reset_err;
+		}
 	}
 
 	err = ohci_register(dev, regs);
-- 
1.9.1



More information about the U-Boot mailing list