aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/stk1160/stk1160-v4l.c
diff options
context:
space:
mode:
authorEzequiel Garcia <ezequiel@vanguardiasur.com.ar>2015-03-10 10:37:14 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-02 17:18:37 -0400
commitaeff09276748b66072f2db2e668cec955cf41959 (patch)
tree6f761c99faefd4167006d2bc679df8847d4cc504 /drivers/media/usb/stk1160/stk1160-v4l.c
parente933c6bc67d8129d184d5add4230eb8250646cb8 (diff)
[media] stk1160: Make sure current buffer is released
The available (i.e. not used) buffers are returned by stk1160_clear_queue(), on the stop_streaming() path. However, this is insufficient and the current buffer must be released as well. Fix it. Cc: stable@vger.kernel.org Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb/stk1160/stk1160-v4l.c')
-rw-r--r--drivers/media/usb/stk1160/stk1160-v4l.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c
index 65a326c5128f..749ad5603c9e 100644
--- a/drivers/media/usb/stk1160/stk1160-v4l.c
+++ b/drivers/media/usb/stk1160/stk1160-v4l.c
@@ -240,6 +240,11 @@ static int stk1160_stop_streaming(struct stk1160 *dev)
240 if (mutex_lock_interruptible(&dev->v4l_lock)) 240 if (mutex_lock_interruptible(&dev->v4l_lock))
241 return -ERESTARTSYS; 241 return -ERESTARTSYS;
242 242
243 /*
244 * Once URBs are cancelled, the URB complete handler
245 * won't be running. This is required to safely release the
246 * current buffer (dev->isoc_ctl.buf).
247 */
243 stk1160_cancel_isoc(dev); 248 stk1160_cancel_isoc(dev);
244 249
245 /* 250 /*
@@ -620,8 +625,16 @@ void stk1160_clear_queue(struct stk1160 *dev)
620 stk1160_info("buffer [%p/%d] aborted\n", 625 stk1160_info("buffer [%p/%d] aborted\n",
621 buf, buf->vb.v4l2_buf.index); 626 buf, buf->vb.v4l2_buf.index);
622 } 627 }
623 /* It's important to clear current buffer */ 628
624 dev->isoc_ctl.buf = NULL; 629 /* It's important to release the current buffer */
630 if (dev->isoc_ctl.buf) {
631 buf = dev->isoc_ctl.buf;
632 dev->isoc_ctl.buf = NULL;
633
634 vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
635 stk1160_info("buffer [%p/%d] aborted\n",
636 buf, buf->vb.v4l2_buf.index);
637 }
625 spin_unlock_irqrestore(&dev->buf_lock, flags); 638 spin_unlock_irqrestore(&dev->buf_lock, flags);
626} 639}
627 640