From e3a736b88ce7443473ee1336ea90309f74131245 Mon Sep 17 00:00:00 2001 From: wlf Date: Thu, 8 May 2014 14:58:11 +0800 Subject: [PATCH] USB: fix the bug that urb enqueue again after kill urb. --- drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c b/drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c index aca9f86d7cd2..c870426f7dca 100755 --- a/drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c +++ b/drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c @@ -983,11 +983,19 @@ static int urb_enqueue(struct usb_hcd *hcd, } #endif - if(atomic_read(&urb->use_count)>1){ + if (unlikely(atomic_read(&urb->use_count) > 1)) { retval = -EPERM; - printk("%s urb %p already in queue, qtd %p, count%d\n", + printk("%s urb %p already in queue, qtd %p, use_count %d\n", __func__, urb, urb->hcpriv, atomic_read(&urb->use_count)); - return retval; + return retval; + } + + if (unlikely(atomic_read(&urb->reject))) { + retval = -EPERM; + printk("%s urb %p submissions will fail, urb->reject %d, use_count %d\n", + __func__, urb, atomic_read(&urb->reject), atomic_read(&urb->use_count)); + return retval; + } if ((usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) -- 2.34.1