Message ID | 20210311122040.1264410-10-ribalda@chromium.org |
---|---|
State | New |
Headers | show |
Series | uvcvideo: Pass v4l2-compliance test | expand |
Hi Ricardo, Thank you for the patch. On Thu, Mar 11, 2021 at 01:20:38PM +0100, Ricardo Ribalda wrote: > Fixes v4l2-compliance: > Control ioctls (Input 0): > fail: v4l2-test-controls.cpp(813): doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls) > test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL > > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> > --- > drivers/media/usb/uvc/uvc_v4l2.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c > index 9b6454bb2f28..b500356fd06c 100644 > --- a/drivers/media/usb/uvc/uvc_v4l2.c > +++ b/drivers/media/usb/uvc/uvc_v4l2.c > @@ -1057,12 +1057,7 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, > struct v4l2_queryctrl qc = { .id = ctrl->id }; > > ret = uvc_query_v4l2_ctrl(chain, &qc); > - if (ret < 0) { > - ctrls->error_idx = i; > - return ret; > - } > - > - ctrl->value = qc.default_value; > + ctrl->value = (ret < 0) ? 0 : qc.default_value; That's not great, if an error occurs, it should be reported to the user, not ignored silently. Sounds like this needs to be addressed in v4l2-compliance, as the V4L2 specification doesn't forbid errors being returned from V4L2_CTRL_WHICH_DEF_VAL. > } > > return 0;
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 9b6454bb2f28..b500356fd06c 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -1057,12 +1057,7 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, struct v4l2_queryctrl qc = { .id = ctrl->id }; ret = uvc_query_v4l2_ctrl(chain, &qc); - if (ret < 0) { - ctrls->error_idx = i; - return ret; - } - - ctrl->value = qc.default_value; + ctrl->value = (ret < 0) ? 0 : qc.default_value; } return 0;
Fixes v4l2-compliance: Control ioctls (Input 0): fail: v4l2-test-controls.cpp(813): doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls) test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> --- drivers/media/usb/uvc/uvc_v4l2.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)