From: Patrice Chotard Date: Mon, 24 Jul 2017 15:07:05 +0000 (+0200) Subject: usb: host: ohci-generic: initialize PHY only when found X-Git-Tag: v2017.09-rc1~32^2~3 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2080d023d90e2972f82dfde624d209cf5a0c569c;p=u-boot 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 Reported-by: Patrick Delaunay --- 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);