Commit e32f856a authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] videobuf2-core: fill in q->bufs[vb->index] before buf_init()

Fill in q->bufs[vb->index] before the call to buf_init: it makes
sense that this is initialized correctly.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 489648af
...@@ -352,6 +352,7 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory, ...@@ -352,6 +352,7 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory,
vb->memory = memory; vb->memory = memory;
for (plane = 0; plane < num_planes; ++plane) for (plane = 0; plane < num_planes; ++plane)
vb->planes[plane].length = q->plane_sizes[plane]; vb->planes[plane].length = q->plane_sizes[plane];
q->bufs[vb->index] = vb;
/* Allocate video buffer memory for the MMAP type */ /* Allocate video buffer memory for the MMAP type */
if (memory == VB2_MEMORY_MMAP) { if (memory == VB2_MEMORY_MMAP) {
...@@ -360,6 +361,7 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory, ...@@ -360,6 +361,7 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory,
dprintk(1, "failed allocating memory for " dprintk(1, "failed allocating memory for "
"buffer %d\n", buffer); "buffer %d\n", buffer);
kfree(vb); kfree(vb);
q->bufs[vb->index] = NULL;
break; break;
} }
/* /*
...@@ -372,12 +374,11 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory, ...@@ -372,12 +374,11 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory,
dprintk(1, "buffer %d %p initialization" dprintk(1, "buffer %d %p initialization"
" failed\n", buffer, vb); " failed\n", buffer, vb);
__vb2_buf_mem_free(vb); __vb2_buf_mem_free(vb);
q->bufs[vb->index] = NULL;
kfree(vb); kfree(vb);
break; break;
} }
} }
q->bufs[q->num_buffers + buffer] = vb;
} }
if (memory == VB2_MEMORY_MMAP) if (memory == VB2_MEMORY_MMAP)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment