summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrice Chotard <patrice.chotard@st.com>2017-07-24 17:07:05 +0200
committerMarek Vasut <marex@denx.de>2017-07-28 23:34:43 +0200
commit2080d023d90e2972f82dfde624d209cf5a0c569c (patch)
treec355cd8a4ce699c948dbe51ce072e7a02324a11b
parent4b3928a08f24d21c2d34487b9d89fee35814bd0d (diff)
usb: host: ohci-generic: initialize PHY only when found
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>
-rw-r--r--drivers/usb/host/ohci-generic.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/usb/host/ohci-generic.c b/drivers/usb/host/ohci-generic.c
index 9249039055..e22ee97939 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);