diff options
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/videobuf/videobuf2-core.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/media/common/videobuf/videobuf2-core.c b/drivers/media/common/videobuf/videobuf2-core.c index 365b30c55ead..9406d7b65550 100644 --- a/drivers/media/common/videobuf/videobuf2-core.c +++ b/drivers/media/common/videobuf/videobuf2-core.c @@ -524,7 +524,7 @@ static int __vb2_queue_free(struct vb2_queue *q, unsigned int buffers) q->num_buffers -= buffers; if (!q->num_buffers) { - q->memory = 0; + q->memory = VB2_MEMORY_UNKNOWN; INIT_LIST_HEAD(&q->queued_list); } return 0; @@ -666,7 +666,8 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory, return -EBUSY; } - if (*count == 0 || q->num_buffers != 0 || q->memory != memory) { + if (*count == 0 || q->num_buffers != 0 || + (q->memory != VB2_MEMORY_UNKNOWN && q->memory != memory)) { /* * We already have buffers allocated, so first check if they * are not in use and can be freed. @@ -1999,6 +2000,8 @@ int vb2_core_queue_init(struct vb2_queue *q) mutex_init(&q->mmap_lock); init_waitqueue_head(&q->done_wq); + q->memory = VB2_MEMORY_UNKNOWN; + if (q->buf_struct_size == 0) q->buf_struct_size = sizeof(struct vb2_buffer); |