[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YEpDohOKcLmfpTHQ@pendragon.ideasonboard.com>
Date: Thu, 11 Mar 2021 18:21:54 +0200
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Ricardo Ribalda <ribalda@...omium.org>
Cc: Mauro Carvalho Chehab <mchehab@...nel.org>,
Tomasz Figa <tfiga@...omium.org>, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org, senozhatsky@...omium.org
Subject: Re: [PATCH 08/10] media: uvcvideo: Always return a value on
V4L2_CTRL_WHICH_DEF_VAL
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@...omium.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;
--
Regards,
Laurent Pinchart
Powered by blists - more mailing lists