From: Meng Dongyang Date: Sun, 11 Sep 2016 08:27:57 +0000 (+0800) Subject: usb: dwc3: fix logical error during controller probe X-Git-Tag: firefly_0821_release~1485 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5c2303a10bc74ed8cff61e9c54a51cbd74a8cabe;p=firefly-linux-kernel-4.4.55.git usb: dwc3: fix logical error during controller probe The probe function of usb controller will remove hcd struct in host or otg mode, while the hcd is alloced after xhci driver registed. So there is a logical error if xhci driver is registed after usb controller and it results in the pointer of hcd point to NULL. This patch make usb controller probe again if hcd point to NULL. Change-Id: I659f86decac59fca610b355356fc971b3a86d4be Signed-off-by: Meng Dongyang --- diff --git a/drivers/usb/dwc3/dwc3-rockchip.c b/drivers/usb/dwc3/dwc3-rockchip.c index 90c34c699e7e..6f549b58b209 100644 --- a/drivers/usb/dwc3/dwc3-rockchip.c +++ b/drivers/usb/dwc3/dwc3-rockchip.c @@ -332,7 +332,11 @@ static int dwc3_rockchip_probe(struct platform_device *pdev) rockchip->dwc->dr_mode == USB_DR_MODE_OTG) { struct usb_hcd *hcd = dev_get_drvdata(&rockchip->dwc->xhci->dev); - + if (!hcd) { + dev_err(dev, "fail to get drvdata hcd\n"); + ret = -EPROBE_DEFER; + goto err2; + } if (hcd->state != HC_STATE_HALT) { usb_remove_hcd(hcd->shared_hcd); usb_remove_hcd(hcd);