usb:langwell_udc: fix a fabric error caused by langwell_ep_dequeue
authorjzhuan5 <jin.can.zhuang@intel.com>
Tue, 17 Apr 2012 02:49:20 +0000 (22:49 -0400)
committerbuildbot <buildbot@intel.com>
Wed, 18 Apr 2012 10:04:23 +0000 (03:04 -0700)
BZ: 32071

upper layer may call usb_ep_dequeue without knowing the power state of
device controller. Conventionally in langwell_udc, got_irq can be used
to check if current state is fully powerd. So we need to make sure got_irq
is set in langwell_ep_dequeue() before accessing any register.

Change-Id: I8e8ae491b368d5392b84ccc4658a6be66b213cb5
Signed-off-by: jzhuan5 <jin.can.zhuang@intel.com>
Reviewed-on: http://android.intel.com:8080/43587
Reviewed-by: Wu, Hao <hao.wu@intel.com>
Reviewed-by: Tang, Richard <richard.tang@intel.com>
Reviewed-by: Meng, Zhe <zhe.meng@intel.com>
Tested-by: Meng, Zhe <zhe.meng@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/usb/gadget/langwell_udc.c

index 6be086b..8f70322 100644 (file)
@@ -1041,6 +1041,9 @@ static int langwell_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
        dev = ep->dev;
        dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
 
+       if (!dev->got_irq)
+               return -ENODEV;
+
        if (!ep->desc)
                return -EINVAL;