From: Michael Grzeschik <[email protected]>

If the pending buffers in the queue could not be pushed to the udc
endpoint we have to cancel the uvc_queue. Otherwise the gadget will get
stuck on this error. This patch calls uvc_queue_cancel if usb_ep_queue
failed.

Signed-off-by: Michael Grzeschik <[email protected]>
---
 drivers/usb/gadget/uvc_video.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/gadget/uvc_video.c b/drivers/usb/gadget/uvc_video.c
index 71e896d..1f66888 100644
--- a/drivers/usb/gadget/uvc_video.c
+++ b/drivers/usb/gadget/uvc_video.c
@@ -194,6 +194,7 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request 
*req)
        if ((ret = usb_ep_queue(ep, req, GFP_ATOMIC)) < 0) {
                printk(KERN_INFO "Failed to queue request (%d).\n", ret);
                usb_ep_set_halt(ep);
+               uvc_queue_cancel(queue, 0);
                spin_unlock_irqrestore(&video->queue.irqlock, flags);
                goto requeue;
        }
@@ -281,6 +282,7 @@ error:
 static int
 uvc_video_pump(struct uvc_video *video)
 {
+       struct uvc_video_queue *queue = &video->queue;
        struct usb_request *req;
        struct uvc_buffer *buf;
        unsigned long flags;
@@ -321,6 +323,7 @@ uvc_video_pump(struct uvc_video *video)
                if (ret < 0) {
                        printk(KERN_INFO "Failed to queue request (%d)\n", ret);
                        usb_ep_set_halt(video->ep);
+                       uvc_queue_cancel(queue, 0);
                        spin_unlock_irqrestore(&video->queue.irqlock, flags);
                        break;
                }
-- 
1.8.2.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to