From: wlf Date: Thu, 8 May 2014 06:58:11 +0000 (+0800) Subject: USB: fix the bug that urb enqueue again after kill urb. X-Git-Tag: firefly_0821_release~5332 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e3a736b88ce7443473ee1336ea90309f74131245;p=firefly-linux-kernel-4.4.55.git USB: fix the bug that urb enqueue again after kill urb. --- 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)