Message ID | 20230323-uvc-gadget-cleanup-v1-2-e41f0c5d9d8e@pengutronix.de |
---|---|
State | New |
Headers | show |
Series | usb: gadget: uvc: fix errors reported by v4l2-compliance | expand |
Hi Michael On 23/03/2023 11:41, Michael Tretter wrote: > On success, VIDIOC_REQBUFS should return 0, not the number of allocated > buffers. As uvcg_alloc_buffers() is directly called by regbufs, it has > to return the correct error codes. s/regbufs/reqbufs > > Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> > --- This probably wants a Fixes: tag? Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> > drivers/usb/gadget/function/uvc_queue.c | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/drivers/usb/gadget/function/uvc_queue.c b/drivers/usb/gadget/function/uvc_queue.c > index 0aa3d7e1f3cc..f14f75b93aaa 100644 > --- a/drivers/usb/gadget/function/uvc_queue.c > +++ b/drivers/usb/gadget/function/uvc_queue.c > @@ -179,11 +179,7 @@ void uvcg_free_buffers(struct uvc_video_queue *queue) > int uvcg_alloc_buffers(struct uvc_video_queue *queue, > struct v4l2_requestbuffers *rb) > { > - int ret; > - > - ret = vb2_reqbufs(&queue->queue, rb); > - > - return ret ? ret : rb->count; > + return vb2_reqbufs(&queue->queue, rb); > } > > int uvcg_query_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf) >
On Fri, Mar 24, 2023 at 07:50:11AM +0000, Dan Scally wrote: > Hi Michael > > On 23/03/2023 11:41, Michael Tretter wrote: > > On success, VIDIOC_REQBUFS should return 0, not the number of allocated > > buffers. As uvcg_alloc_buffers() is directly called by regbufs, it has > > to return the correct error codes. > > s/regbufs/reqbufs > > > > > Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> > > --- > > This probably wants a Fixes: tag? Good idea. With that, Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> > > > drivers/usb/gadget/function/uvc_queue.c | 6 +----- > > 1 file changed, 1 insertion(+), 5 deletions(-) > > > > diff --git a/drivers/usb/gadget/function/uvc_queue.c b/drivers/usb/gadget/function/uvc_queue.c > > index 0aa3d7e1f3cc..f14f75b93aaa 100644 > > --- a/drivers/usb/gadget/function/uvc_queue.c > > +++ b/drivers/usb/gadget/function/uvc_queue.c > > @@ -179,11 +179,7 @@ void uvcg_free_buffers(struct uvc_video_queue *queue) > > int uvcg_alloc_buffers(struct uvc_video_queue *queue, > > struct v4l2_requestbuffers *rb) > > { > > - int ret; > > - > > - ret = vb2_reqbufs(&queue->queue, rb); > > - > > - return ret ? ret : rb->count; > > + return vb2_reqbufs(&queue->queue, rb); > > } > > > > int uvcg_query_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf)
diff --git a/drivers/usb/gadget/function/uvc_queue.c b/drivers/usb/gadget/function/uvc_queue.c index 0aa3d7e1f3cc..f14f75b93aaa 100644 --- a/drivers/usb/gadget/function/uvc_queue.c +++ b/drivers/usb/gadget/function/uvc_queue.c @@ -179,11 +179,7 @@ void uvcg_free_buffers(struct uvc_video_queue *queue) int uvcg_alloc_buffers(struct uvc_video_queue *queue, struct v4l2_requestbuffers *rb) { - int ret; - - ret = vb2_reqbufs(&queue->queue, rb); - - return ret ? ret : rb->count; + return vb2_reqbufs(&queue->queue, rb); } int uvcg_query_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf)
On success, VIDIOC_REQBUFS should return 0, not the number of allocated buffers. As uvcg_alloc_buffers() is directly called by regbufs, it has to return the correct error codes. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> --- drivers/usb/gadget/function/uvc_queue.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)