]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: host: ehci-generic: initialize PHY only when found
authorPatrice Chotard <patrice.chotard@st.com>
Mon, 24 Jul 2017 15:07:04 +0000 (17:07 +0200)
committerMarek Vasut <marex@denx.de>
Fri, 28 Jul 2017 21:34:43 +0000 (23:34 +0200)
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@st.com>
Reported-by: Patrick Delaunay <patrick.delaunay@st.com>
drivers/usb/host/ehci-generic.c

index 3f751f1ecdcae838768305aad63db297a9e61e61..03f8d321af13e3ddb04c46ae9a66d16b82defe73 100644 (file)
@@ -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);