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@xxxxxxxxxxx> --- drivers/media/v4l2-core/v4l2-mem2mem.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) 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; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html