The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Tomasz Figa <tfiga@chromium.org>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>
Subject: Re: [PATCH 03/10] media: uvcvideo: Return -EIO for control errors
Date: Thu, 11 Mar 2021 17:57:24 +0200	[thread overview]
Message-ID: <YEo95GqO0XEX4Cg0@pendragon.ideasonboard.com> (raw)
In-Reply-To: <CANiDSCtw2q7UxMoZSMeE545WCxMs-WSHR2xbjG+xWL9CaBE3Aw@mail.gmail.com>

Hi Ricardo,

Thank you for the patch.

On Thu, Mar 11, 2021 at 03:08:22PM +0100, Ricardo Ribalda wrote:
> As discussed in the IRC with Hans
> 
> We need to specify in the commit message that this is most likely due
> to hw error.
> 
> On Thu, Mar 11, 2021 at 1:20 PM Ricardo Ribalda <ribalda@chromium.org> wrote:
> >
> > Fixes v4l2-compliance:
> >
> > Control ioctls (Input 0):
> >                 fail: v4l2-test-controls.cpp(448): s_ctrl returned an error (22)
> >         test VIDIOC_G/S_CTRL: FAIL
> >                 fail: v4l2-test-controls.cpp(698): s_ext_ctrls returned an error (22)
> >         test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL

As this isn't supposed to happen, how do you reproduce this ? 

> > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> > ---
> >  drivers/media/usb/uvc/uvc_video.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> > index f2f565281e63..5442e9be1c55 100644
> > --- a/drivers/media/usb/uvc/uvc_video.c
> > +++ b/drivers/media/usb/uvc/uvc_video.c
> > @@ -113,7 +113,7 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit,
> >         case 6: /* Invalid control */
> >         case 7: /* Invalid Request */

For cases 5-7 I think -EIO is fine, as the driver should really not call
this function with an invalid unit, control or request. If it does, it's
a bug in the driver (we can check the units and controls the device
claims to support, and the requests are defined by the UVC
specification), if it doesn't and the device still returns this error,
it's a bug on the device side.

> >         case 8: /* Invalid value within range */

For this case, however, isn't it valid for a device to return an error
if the control value isn't valid ? There's one particular code path I'm
concerned about, uvc_ioctl_default(UVCIOC_CTRL_QUERY) ->
uvc_xu_ctrl_query() -> uvc_query_ctrl(), where it could be useful for
userspace to know that the value it sets isn't valid.

> > -               return -EINVAL;
> > +               return -EIO;
> >         default: /* reserved or unknown */
> >                 break;
> >         }

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2021-03-11 15:58 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 12:20 [PATCH 00/10] uvcvideo: Pass v4l2-compliance test Ricardo Ribalda
2021-03-11 12:20 ` [PATCH 01/10] media: uvcvideo: Return -EINVAL for REQUEST API Ricardo Ribalda
2021-03-11 12:20 ` [PATCH] media: videobuf2: Explicitly state max size of planes Ricardo Ribalda
2021-03-11 12:20 ` [PATCH 02/10] media: uvcvideo: Set capability in s_param Ricardo Ribalda
2021-03-11 15:42   ` Laurent Pinchart
2021-03-11 12:20 ` [PATCH 03/10] media: uvcvideo: Return -EIO for control errors Ricardo Ribalda
2021-03-11 14:08   ` Ricardo Ribalda
2021-03-11 15:57     ` Laurent Pinchart [this message]
2021-03-11 21:56       ` Ricardo Ribalda Delgado
2021-03-11 14:08   ` Hans Verkuil
2021-03-11 12:20 ` [PATCH 04/10] media: uvcvideo: Add support for V4L2_CTRL_TYPE_CTRL_CLASS Ricardo Ribalda
2021-03-11 12:20 ` [PATCH 05/10] media: uvcvideo: Define Control and GUIDs for class ctrls Ricardo Ribalda
2021-03-11 12:20 ` [PATCH 06/10] media: uvcvideo: Implement UVC_CTRL_CLASS_UNIT Ricardo Ribalda
2021-03-11 16:06   ` Laurent Pinchart
2021-03-11 12:20 ` [PATCH 07/10] media: uvcvideo: set error_idx to count on EACCESS Ricardo Ribalda
2021-03-11 16:18   ` Laurent Pinchart
2021-03-11 21:51     ` Ricardo Ribalda Delgado
2021-03-11 12:20 ` [PATCH 08/10] media: uvcvideo: Always return a value on V4L2_CTRL_WHICH_DEF_VAL Ricardo Ribalda
2021-03-11 16:21   ` Laurent Pinchart
2021-03-11 12:20 ` [PATCH 09/10] media: uvcvideo: Do not create initial events for class ctrls Ricardo Ribalda
2021-03-11 12:20 ` [PATCH 10/10] media: uvcvideo: Populate only active control classes Ricardo Ribalda
2021-03-11 14:31   ` Hans Verkuil
2021-03-11 15:21     ` Ricardo Ribalda Delgado
2021-03-11 15:59       ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YEo95GqO0XEX4Cg0@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.org \
    --cc=senozhatsky@chromium.org \
    --cc=tfiga@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox