summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/uvc_queue.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2013-04-29 22:18:01 +0200
committerFelipe Balbi <balbi@ti.com>2013-08-09 16:40:54 +0200
commitebe864a6cb8e087ede047fa1fa6b6d06fcb9a9e4 (patch)
tree2b31ce7fc5db0b88d22c8ff1b1790e4efd002c4a /drivers/usb/gadget/uvc_queue.c
parentusb: musb dma: add cppi41 dma driver (diff)
downloadlinux-ebe864a6cb8e087ede047fa1fa6b6d06fcb9a9e4.tar.xz
linux-ebe864a6cb8e087ede047fa1fa6b6d06fcb9a9e4.zip
usb: gadget: uvc: Fix error handling in uvc_queue_buffer()
The conversion to videobuf2 failed to check the return value of vb2_qbuf(). Fix it. Cc: stable@vger.kernel.org Reported-by: Michael Grzeschik <mgr@pengutronix.de> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-By: Michael Grzeschik <mgr@pengutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/uvc_queue.c')
-rw-r--r--drivers/usb/gadget/uvc_queue.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c
index e6170478ea9f..0bb5d50075de 100644
--- a/drivers/usb/gadget/uvc_queue.c
+++ b/drivers/usb/gadget/uvc_queue.c
@@ -193,12 +193,16 @@ static int uvc_queue_buffer(struct uvc_video_queue *queue,
mutex_lock(&queue->mutex);
ret = vb2_qbuf(&queue->queue, buf);
+ if (ret < 0)
+ goto done;
+
spin_lock_irqsave(&queue->irqlock, flags);
ret = (queue->flags & UVC_QUEUE_PAUSED) != 0;
queue->flags &= ~UVC_QUEUE_PAUSED;
spin_unlock_irqrestore(&queue->irqlock, flags);
- mutex_unlock(&queue->mutex);
+done:
+ mutex_unlock(&queue->mutex);
return ret;
}