aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorPatrice Chotard <patrice.chotard@st.com>2017-07-24 17:07:04 +0200
committerMarek Vasut <marex@denx.de>2017-07-28 23:34:43 +0200
commit4b3928a08f24d21c2d34487b9d89fee35814bd0d (patch)
treeb2fce47816b22c714b01427d9899d837460a9303 /drivers/usb
parent623b7aca1f82bf1dee089c77f9a1020e80abaccc (diff)
downloadu-boot-4b3928a08f24d21c2d34487b9d89fee35814bd0d.zip
u-boot-4b3928a08f24d21c2d34487b9d89fee35814bd0d.tar.gz
u-boot-4b3928a08f24d21c2d34487b9d89fee35814bd0d.tar.bz2
usb: host: ehci-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>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ehci-generic.c11
1 files 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);