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 <daniel.meng@rock-chips.com>
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);