aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/v4l2-core
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2015-11-20 09:31:11 -0200
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-12-18 14:03:54 -0200
commite32f856ab29e9369c055e6b7f0e554c79341b1c6 (patch)
treef6e9a91392e32a51f42b0a63ecff6c17b25f5c2e /drivers/media/v4l2-core
parent[media] videobuf2-core: move __setup_lengths into __vb2_queue_alloc() (diff)
downloadlinux-dev-e32f856ab29e9369c055e6b7f0e554c79341b1c6.tar.xz
linux-dev-e32f856ab29e9369c055e6b7f0e554c79341b1c6.zip
[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: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r--drivers/media/v4l2-core/videobuf2-core.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index 96dca473bc83..98b5449b06eb 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -352,6 +352,7 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory,
vb->memory = memory;
for (plane = 0; plane < num_planes; ++plane)
vb->planes[plane].length = q->plane_sizes[plane];
+ q->bufs[vb->index] = vb;
/* Allocate video buffer memory for the MMAP type */
if (memory == VB2_MEMORY_MMAP) {
@@ -360,6 +361,7 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory,
dprintk(1, "failed allocating memory for "
"buffer %d\n", buffer);
kfree(vb);
+ q->bufs[vb->index] = NULL;
break;
}
/*
@@ -372,12 +374,11 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory,
dprintk(1, "buffer %d %p initialization"
" failed\n", buffer, vb);
__vb2_buf_mem_free(vb);
+ q->bufs[vb->index] = NULL;
kfree(vb);
break;
}
}
-
- q->bufs[q->num_buffers + buffer] = vb;
}
if (memory == VB2_MEMORY_MMAP)