Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 348005
b: refs/heads/master
c: 9c016d6
h: refs/heads/master
i:
  348003: 97e1f70
v: v3
  • Loading branch information
Rafael J. Wysocki authored and Linus Torvalds committed Dec 23, 2012
1 parent 5fd0efc commit 3de965c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a49f0d1ea3ec94fc7cf33a7c36a16343b74bd565
refs/heads/master: 9c016d61097cc39427a2f5025bdd97ac633d26a6
19 changes: 8 additions & 11 deletions trunk/drivers/media/usb/uvc/uvc_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,

ctrl = uvc_find_control(chain, v4l2_ctrl->id, &mapping);
if (ctrl == NULL) {
ret = -ENOENT;
ret = -EINVAL;
goto done;
}

Expand Down Expand Up @@ -1099,13 +1099,12 @@ int uvc_query_v4l2_menu(struct uvc_video_chain *chain,
return -ERESTARTSYS;

ctrl = uvc_find_control(chain, query_menu->id, &mapping);
if (ctrl == NULL) {
ret = -ENOENT;
if (ctrl == NULL || mapping->v4l2_type != V4L2_CTRL_TYPE_MENU) {
ret = -EINVAL;
goto done;
}

if (mapping->v4l2_type != V4L2_CTRL_TYPE_MENU ||
query_menu->index >= mapping->menu_count) {
if (query_menu->index >= mapping->menu_count) {
ret = -EINVAL;
goto done;
}
Expand Down Expand Up @@ -1264,7 +1263,7 @@ static int uvc_ctrl_add_event(struct v4l2_subscribed_event *sev, unsigned elems)

ctrl = uvc_find_control(handle->chain, sev->id, &mapping);
if (ctrl == NULL) {
ret = -ENOENT;
ret = -EINVAL;
goto done;
}

Expand Down Expand Up @@ -1415,7 +1414,7 @@ int uvc_ctrl_get(struct uvc_video_chain *chain,

ctrl = uvc_find_control(chain, xctrl->id, &mapping);
if (ctrl == NULL)
return -ENOENT;
return -EINVAL;

return __uvc_ctrl_get(chain, ctrl, mapping, &xctrl->value);
}
Expand All @@ -1432,10 +1431,8 @@ int uvc_ctrl_set(struct uvc_video_chain *chain,
int ret;

ctrl = uvc_find_control(chain, xctrl->id, &mapping);
if (ctrl == NULL)
return -ENOENT;
if (!(ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR))
return -EACCES;
if (ctrl == NULL || (ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR) == 0)
return -EINVAL;

/* Clamp out of range values. */
switch (mapping->v4l2_type) {
Expand Down
12 changes: 5 additions & 7 deletions trunk/drivers/media/usb/uvc/uvc_v4l2.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)

ret = uvc_ctrl_get(chain, &xctrl);
uvc_ctrl_rollback(handle);
if (ret < 0)
return ret == -ENOENT ? -EINVAL : ret;

ctrl->value = xctrl.value;
if (ret >= 0)
ctrl->value = xctrl.value;
break;
}

Expand All @@ -634,7 +632,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
ret = uvc_ctrl_set(chain, &xctrl);
if (ret < 0) {
uvc_ctrl_rollback(handle);
return ret == -ENOENT ? -EINVAL : ret;
return ret;
}
ret = uvc_ctrl_commit(handle, &xctrl, 1);
if (ret == 0)
Expand All @@ -661,7 +659,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
uvc_ctrl_rollback(handle);
ctrls->error_idx = ret == -ENOENT
? ctrls->count : i;
return ret == -ENOENT ? -EINVAL : ret;
return ret;
}
}
ctrls->error_idx = 0;
Expand Down Expand Up @@ -691,7 +689,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
ctrls->error_idx = (ret == -ENOENT &&
cmd == VIDIOC_S_EXT_CTRLS)
? ctrls->count : i;
return ret == -ENOENT ? -EINVAL : ret;
return ret;
}
}

Expand Down

0 comments on commit 3de965c

Please sign in to comment.