diff options
author | Meng Dongyang <daniel.meng@rock-chips.com> | 2016-09-11 16:27:57 +0800 |
---|---|---|
committer | Kever Yang <kever.yang@rock-chips.com> | 2016-09-23 18:26:06 +0800 |
commit | 5c2303a10bc74ed8cff61e9c54a51cbd74a8cabe (patch) | |
tree | 0e7ecea25f89cf5455339ce40a8dec83d413a255 /drivers | |
parent | fe2fc59322701886c63c652d8dd94f679a05dba4 (diff) |
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 <daniel.meng@rock-chips.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/dwc3/dwc3-rockchip.c | 6 |
1 files changed, 5 insertions, 1 deletions
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); |