diff options
Diffstat (limited to 'drivers/media/usb/uvc/uvc_queue.c')
-rw-r--r-- | drivers/media/usb/uvc/uvc_queue.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c index cfb868a48b5f..54394722756f 100644 --- a/drivers/media/usb/uvc/uvc_queue.c +++ b/drivers/media/usb/uvc/uvc_queue.c @@ -69,23 +69,19 @@ static void uvc_queue_return_buffers(struct uvc_video_queue *queue, * videobuf2 queue operations */ -static int uvc_queue_setup(struct vb2_queue *vq, const void *parg, +static int uvc_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, unsigned int *nplanes, unsigned int sizes[], void *alloc_ctxs[]) { - const struct v4l2_format *fmt = parg; struct uvc_video_queue *queue = vb2_get_drv_priv(vq); struct uvc_streaming *stream = uvc_queue_to_stream(queue); + unsigned size = stream->ctrl.dwMaxVideoFrameSize; /* Make sure the image size is large enough. */ - if (fmt && fmt->fmt.pix.sizeimage < stream->ctrl.dwMaxVideoFrameSize) - return -EINVAL; - + if (*nplanes) + return sizes[0] < size ? -EINVAL : 0; *nplanes = 1; - - sizes[0] = fmt ? fmt->fmt.pix.sizeimage - : stream->ctrl.dwMaxVideoFrameSize; - + sizes[0] = size; return 0; } |