Ricardo Ribalda ee929d5a10 media: uvcvideo: Check controls flags before accessing them
We can figure out if reading/writing a set of controls can fail without
accessing them by checking their flags.

This way we can honor the API closer:

If an error is found when validating the list of controls passed with
VIDIOC_G_EXT_CTRLS, then error_idx shall be set to ctrls->count to
indicate to userspace that no actual hardware was touched.

Fixes v4l2-compliance:
Control ioctls (Input 0):
		warn: v4l2-test-controls.cpp(765): g_ext_ctrls(0) invalid error_idx 0
                fail: v4l2-test-controls.cpp(645): invalid error index write only control
        test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL

Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-09-30 10:07:48 +02:00
..
2021-09-01 08:44:42 -07:00
2021-09-11 14:48:42 -07:00
2021-09-01 15:25:28 -07:00
2021-09-07 12:38:59 -07:00
2021-09-07 19:13:42 -07:00
2021-09-09 11:48:27 -07:00
2021-09-09 11:39:57 -07:00
2021-09-08 11:50:26 -07:00
2021-09-09 11:07:47 -07:00
2021-09-24 10:14:19 -07:00
2021-09-15 17:18:56 -07:00
2021-09-02 13:49:39 -07:00
2021-09-11 14:48:42 -07:00
2021-09-01 09:51:16 -07:00
2021-09-03 15:33:47 -07:00
2021-09-01 08:44:42 -07:00
2021-09-07 12:38:59 -07:00
2021-09-23 10:30:31 -07:00
2021-09-09 11:48:27 -07:00
2021-09-21 09:17:15 +02:00
2021-09-25 15:37:31 -07:00
2021-09-03 15:33:47 -07:00
2021-09-20 11:11:54 +01:00
2021-09-01 15:25:28 -07:00
2021-09-23 10:30:31 -07:00
2021-09-01 08:44:42 -07:00
2021-09-01 15:25:28 -07:00
2021-09-01 10:29:29 -07:00
2021-09-22 11:58:24 -07:00
2021-09-14 11:18:47 +02:00
2021-09-24 10:22:53 +02:00
2021-09-11 14:48:42 -07:00
2021-09-02 13:41:33 -07:00
2021-09-18 11:15:01 -07:00
2021-09-11 14:48:42 -07:00
2021-09-25 15:37:31 -07:00