Commit 5712661d authored by Ezequiel Garcia's avatar Ezequiel Garcia Committed by Mauro Carvalho Chehab

[media] uvc: Add return code check at vb2_queue_init()

This function returns an integer and it's mandatory
to check the return code.
Signed-off-by: default avatarEzequiel Garcia <elezegarcia@gmail.com>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e0f6e4d6
...@@ -122,21 +122,27 @@ static struct vb2_ops uvc_queue_qops = { ...@@ -122,21 +122,27 @@ static struct vb2_ops uvc_queue_qops = {
.buf_finish = uvc_buffer_finish, .buf_finish = uvc_buffer_finish,
}; };
void uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type, int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type,
int drop_corrupted) int drop_corrupted)
{ {
int ret;
queue->queue.type = type; queue->queue.type = type;
queue->queue.io_modes = VB2_MMAP | VB2_USERPTR; queue->queue.io_modes = VB2_MMAP | VB2_USERPTR;
queue->queue.drv_priv = queue; queue->queue.drv_priv = queue;
queue->queue.buf_struct_size = sizeof(struct uvc_buffer); queue->queue.buf_struct_size = sizeof(struct uvc_buffer);
queue->queue.ops = &uvc_queue_qops; queue->queue.ops = &uvc_queue_qops;
queue->queue.mem_ops = &vb2_vmalloc_memops; queue->queue.mem_ops = &vb2_vmalloc_memops;
vb2_queue_init(&queue->queue); ret = vb2_queue_init(&queue->queue);
if (ret)
return ret;
mutex_init(&queue->mutex); mutex_init(&queue->mutex);
spin_lock_init(&queue->irqlock); spin_lock_init(&queue->irqlock);
INIT_LIST_HEAD(&queue->irqqueue); INIT_LIST_HEAD(&queue->irqqueue);
queue->flags = drop_corrupted ? UVC_QUEUE_DROP_CORRUPTED : 0; queue->flags = drop_corrupted ? UVC_QUEUE_DROP_CORRUPTED : 0;
return 0;
} }
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
......
...@@ -1755,7 +1755,9 @@ int uvc_video_init(struct uvc_streaming *stream) ...@@ -1755,7 +1755,9 @@ int uvc_video_init(struct uvc_streaming *stream)
atomic_set(&stream->active, 0); atomic_set(&stream->active, 0);
/* Initialize the video buffers queue. */ /* Initialize the video buffers queue. */
uvc_queue_init(&stream->queue, stream->type, !uvc_no_drop_param); ret = uvc_queue_init(&stream->queue, stream->type, !uvc_no_drop_param);
if (ret)
return ret;
/* Alternate setting 0 should be the default, yet the XBox Live Vision /* Alternate setting 0 should be the default, yet the XBox Live Vision
* Cam (and possibly other devices) crash or otherwise misbehave if * Cam (and possibly other devices) crash or otherwise misbehave if
......
...@@ -600,7 +600,7 @@ extern struct uvc_driver uvc_driver; ...@@ -600,7 +600,7 @@ extern struct uvc_driver uvc_driver;
extern struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id); extern struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id);
/* Video buffers queue management. */ /* Video buffers queue management. */
extern void uvc_queue_init(struct uvc_video_queue *queue, extern int uvc_queue_init(struct uvc_video_queue *queue,
enum v4l2_buf_type type, int drop_corrupted); enum v4l2_buf_type type, int drop_corrupted);
extern int uvc_alloc_buffers(struct uvc_video_queue *queue, extern int uvc_alloc_buffers(struct uvc_video_queue *queue,
struct v4l2_requestbuffers *rb); struct v4l2_requestbuffers *rb);
......
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