From: Patrice Chotard Date: Mon, 24 Jul 2017 15:07:04 +0000 (+0200) Subject: usb: host: ehci-generic: initialize PHY only when found X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=4b3928a08f24d21c2d34487b9d89fee35814bd0d;p=u-boot.git 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 Reported-by: Patrick Delaunay --- diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c index 3f751f1ecd..03f8d321af 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);