Skip to contentSkip to conversation

media: video-i2c: fix buffer queue ordering

PATCH New Arash Golgol 1 participant 1 message May 10

Subsystems (2)
lore
Share & tools
lore

Arash Golgol

author Applied
#0 lore raw

PATCH v2 1/1 media: video-i2c: fix buffer queue ordering

Queued buffers are added to the tail of vid_cap_active in buffer_queue(), but the capture kthread also retrieves buffers from the tail of the list.

This makes the queue behave as LIFO instead of FIFO when multiple buffers are queued.

Fix this by retrieving buffers from the head of the list.

---
Changes in v2:
- Fix Media CI robot warning about open parenthesis
- Link to report: https://linux-media.pages.freedesktop.org/-/users/patchwork/-/jobs/99429813/artifacts/report.htm
- Link to v1: https://patchwork.kernel.org/project/linux-media/patch/[email protected]/

 drivers/media/i2c/video-i2c.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/i2c/video-i2c.c +3 -2
index fef3993f4e2d..38c35a8c80f8 100644
@@ -454,8 +454,9 @@ static int video_i2c_thread_vid_cap(void *priv)
 		spin_lock(&data->slock);
 
 		if (!list_empty(&data->vid_cap_active)) {
-			vid_cap_buf = list_last_entry(&data->vid_cap_active,
-						 struct video_i2c_buffer, list);
+			vid_cap_buf = list_first_entry(&data->vid_cap_active,
+						       struct video_i2c_buffer,
+						       list);
 			list_del(&vid_cap_buf->list);
 		}
 
Signature · 1 line
2.34.1