]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
usb: host: ohci-generic: initialize PHY only when found
authorPatrice Chotard <patrice.chotard@st.com>
Mon, 24 Jul 2017 15:07:05 +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/ohci-generic.c

index 9249039055a01ec89a6e04908cc0b28b6f409f93..e22ee9793914d27b7b146303881a18054eacd695 100644 (file)
@@ -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);