[media] v4l2-ioctl: allow all controls if ctrl_class == 0

The check_ext_ctrls() function in v4l2-ioctl.c checks if all controls in the
control array are from the same control class as c->ctrl_class. However,
that check should only be done if c->ctrl_class != 0. A 0 value means
that this restriction does not apply.

So return 1 (OK) if c->ctrl_class == 0.

Found by running v4l2-compliance on the uvc driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
Hans Verkuil 2015-03-14 13:28:25 -03:00 committed by Mauro Carvalho Chehab
parent 2c9fc463d6
commit 9b239b22df
1 changed files with 2 additions and 0 deletions

View File

@ -901,6 +901,8 @@ static int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv)
*/ */
if (!allow_priv && c->ctrl_class == V4L2_CID_PRIVATE_BASE) if (!allow_priv && c->ctrl_class == V4L2_CID_PRIVATE_BASE)
return 0; return 0;
if (c->ctrl_class == 0)
return 1;
/* Check that all controls are from the same control class. */ /* Check that all controls are from the same control class. */
for (i = 0; i < c->count; i++) { for (i = 0; i < c->count; i++) {
if (V4L2_CTRL_ID2CLASS(c->controls[i].id) != c->ctrl_class) { if (V4L2_CTRL_ID2CLASS(c->controls[i].id) != c->ctrl_class) {