diff mbox

media: v4l2-mem2mem: Fixed bug v4l2_m2m_streamoff function

Message ID 000001ced5d4$4fd78330$ef868990$@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sungchun Kang Oct. 31, 2013, 12:58 a.m. UTC
In multi-instance scenario with multi-core, m2m_ctx->queue is removed again
sometimes.
So, it is need to check whether the queue is removed or not.
 
Change-Id: Ie938e9026039304388a369d5d10d1654213ba3b1
Signed-off-by: Sungchun Kang <sungchun.kang@samsung.com>
---
drivers/media/v4l2-core/v4l2-mem2mem.c |   11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-
core/v4l2-mem2mem.c
index 8512314..47b8fdd 100644
--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
@@ -438,9 +438,14 @@  int v4l2_m2m_streamoff(struct file *file, struct
v4l2_m2m_ctx *m2m_ctx,
m2m_dev = m2m_ctx->m2m_dev;
spin_lock_irqsave(&m2m_dev->job_spinlock, flags_job);
/* We should not be scheduled anymore, since we're dropping a queue. */
-       if (!list_empty(&m2m_dev->job_queue))
-               list_del(&m2m_ctx->queue);
-
+       if (!list_empty(&m2m_dev->job_queue)) {
+               struct v4l2_m2m_ctx *list_ctx, *temp_ctx;
+               list_for_each_entry_safe(list_ctx, temp_ctx,
+                       &m2m_dev->job_queue, queue) {
+               if (list_ctx == m2m_ctx)
+                       list_del(&m2m_ctx->queue);
+               }
+       }
INIT_LIST_HEAD(&m2m_ctx->queue);
m2m_ctx->job_flags = 0;