Skip to contentSkip to conversation

media: videobuf2: num_buffers should record the number of all buffers

PATCH NAK Dianlong Li 2 participants 2 messages Mar 29, 2021 – Apr 6, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: videobuf2: num_buffers should record the number of all buffers

The variable q->num_buffers records the number of buffers previously applied for, and the variable allocated_buffers records the number of buffers applied for this time, so the total number should be the sum of these two buffers.

---
 drivers/media/common/videobuf2/videobuf2-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/common/videobuf2/videobuf2-core.c +1 -1
index 4eab6d81cce1..2716c4138655 100644
@@ -836,7 +836,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
 	}
 
 	mutex_lock(&q->mmap_lock);
-	q->num_buffers = allocated_buffers;
+	q->num_buffers += allocated_buffers;
 
 	if (ret < 0) {
 		/*
Signature · 1 line
2.25.1
Nacked-by on v1 1/1 NAK
#1 lore raw
Quoted 16 lines · Dianlong Li

The variable q->num_buffers records the number of buffers previously applied for, and the variable allocated_buffers records the number of buffers applied for this time, so the total number should be the sum of these two buffers.

---
 drivers/media/common/videobuf2/videobuf2-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/common/videobuf2/videobuf2-core.c +0 -0
index 4eab6d81cce1..2716c4138655 100644

drivers/media/common/videobuf2/videobuf2-core.c int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory, · line 842

Quoted 8 lines
drivers/media/common/videobuf2/videobuf2-core.c +1 -1
@@ -836,7 +836,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
 	}
 
 	mutex_lock(&q->mmap_lock);
-	q->num_buffers = allocated_buffers;
+	q->num_buffers += allocated_buffers;
 
 	if (ret < 0) {
 		/*

The VIDIOC_REQBUFS ioctl releases all existing buffers (if any) and allocates new buffers. So the existing code is correct.

Regards,

Hans