On Sun May 10 07:04:23 2026 +0330, Arash Golgol wrote:
> 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.
> 
> Signed-off-by: Arash Golgol <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>

Patch committed.

Thanks,
Hans Verkuil

 drivers/media/i2c/video-i2c.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

---

diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c
index 9c47f4aaa359..2b23914717d1 100644
--- a/drivers/media/i2c/video-i2c.c
+++ b/drivers/media/i2c/video-i2c.c
@@ -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);
                }
 
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to