From: Patrice Chotard <patrice.chot...@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.chot...@st.com>
Reported-by: Patrick Delaunay <patrick.delau...@st.com>
---
 drivers/usb/host/ehci-generic.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c
index 3f751f1..03f8d32 100644
--- a/drivers/usb/host/ehci-generic.c
+++ b/drivers/usb/host/ehci-generic.c
@@ -99,12 +99,13 @@ static int ehci_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;
+               }
        }
 
        hccr = map_physmem(devfdt_get_addr(dev), 0x100, MAP_NOCACHE);
-- 
1.9.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to