Skip to contentSkip to conversation

media: v4l2-mem2mem: Fixed bug v4l2_m2m_streamoff function

PATCH New 강성천 1 participant 1 message Oct 31, 2013 Media (V4L/DVB)

lore
Share & tools
lore

강성천

author
#0 lore raw

PATCH 1/1 media: v4l2-mem2mem: Fixed bug v4l2_m2m_streamoff function

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

---
drivers/media/v4l2-core/v4l2-mem2mem.c | 11 ++++++++---

1 files changed, 8 insertions(+), 3 deletions(-)
drivers/media/v4l2- renamed from drivers/media/v4l2-core/v4l2-mem2mem.c +0 -0

core/v4l2-mem2mem.c
index 8512314..47b8fdd 100644

drivers/media/v4l2-core/v4l2-mem2mem.c +0 -0
@@ -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;

Signature · 1 line
1.7.4.1