Commit aeff0927 authored by Ezequiel Garcia's avatar Ezequiel Garcia Committed by Mauro Carvalho Chehab

[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: default avatarEzequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent e933c6bc
...@@ -240,6 +240,11 @@ static int stk1160_stop_streaming(struct stk1160 *dev) ...@@ -240,6 +240,11 @@ static int stk1160_stop_streaming(struct stk1160 *dev)
if (mutex_lock_interruptible(&dev->v4l_lock)) if (mutex_lock_interruptible(&dev->v4l_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
/*
* Once URBs are cancelled, the URB complete handler
* won't be running. This is required to safely release the
* current buffer (dev->isoc_ctl.buf).
*/
stk1160_cancel_isoc(dev); stk1160_cancel_isoc(dev);
/* /*
...@@ -620,8 +625,16 @@ void stk1160_clear_queue(struct stk1160 *dev) ...@@ -620,8 +625,16 @@ void stk1160_clear_queue(struct stk1160 *dev)
stk1160_info("buffer [%p/%d] aborted\n", stk1160_info("buffer [%p/%d] aborted\n",
buf, buf->vb.v4l2_buf.index); buf, buf->vb.v4l2_buf.index);
} }
/* It's important to clear current buffer */
dev->isoc_ctl.buf = NULL; /* It's important to release the current buffer */
if (dev->isoc_ctl.buf) {
buf = dev->isoc_ctl.buf;
dev->isoc_ctl.buf = NULL;
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
stk1160_info("buffer [%p/%d] aborted\n",
buf, buf->vb.v4l2_buf.index);
}
spin_unlock_irqrestore(&dev->buf_lock, flags); spin_unlock_irqrestore(&dev->buf_lock, flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment