diff options
Diffstat (limited to 'drivers/media/usb/uvc/uvc_ctrl.c')
-rw-r--r-- | drivers/media/usb/uvc/uvc_ctrl.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index 516a5b188ea5..2bb7613ddebb 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c | |||
@@ -1061,7 +1061,7 @@ int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, | |||
1061 | 1061 | ||
1062 | ctrl = uvc_find_control(chain, v4l2_ctrl->id, &mapping); | 1062 | ctrl = uvc_find_control(chain, v4l2_ctrl->id, &mapping); |
1063 | if (ctrl == NULL) { | 1063 | if (ctrl == NULL) { |
1064 | ret = -ENOENT; | 1064 | ret = -EINVAL; |
1065 | goto done; | 1065 | goto done; |
1066 | } | 1066 | } |
1067 | 1067 | ||
@@ -1099,13 +1099,12 @@ int uvc_query_v4l2_menu(struct uvc_video_chain *chain, | |||
1099 | return -ERESTARTSYS; | 1099 | return -ERESTARTSYS; |
1100 | 1100 | ||
1101 | ctrl = uvc_find_control(chain, query_menu->id, &mapping); | 1101 | ctrl = uvc_find_control(chain, query_menu->id, &mapping); |
1102 | if (ctrl == NULL) { | 1102 | if (ctrl == NULL || mapping->v4l2_type != V4L2_CTRL_TYPE_MENU) { |
1103 | ret = -ENOENT; | 1103 | ret = -EINVAL; |
1104 | goto done; | 1104 | goto done; |
1105 | } | 1105 | } |
1106 | 1106 | ||
1107 | if (mapping->v4l2_type != V4L2_CTRL_TYPE_MENU || | 1107 | if (query_menu->index >= mapping->menu_count) { |
1108 | query_menu->index >= mapping->menu_count) { | ||
1109 | ret = -EINVAL; | 1108 | ret = -EINVAL; |
1110 | goto done; | 1109 | goto done; |
1111 | } | 1110 | } |
@@ -1264,7 +1263,7 @@ static int uvc_ctrl_add_event(struct v4l2_subscribed_event *sev, unsigned elems) | |||
1264 | 1263 | ||
1265 | ctrl = uvc_find_control(handle->chain, sev->id, &mapping); | 1264 | ctrl = uvc_find_control(handle->chain, sev->id, &mapping); |
1266 | if (ctrl == NULL) { | 1265 | if (ctrl == NULL) { |
1267 | ret = -ENOENT; | 1266 | ret = -EINVAL; |
1268 | goto done; | 1267 | goto done; |
1269 | } | 1268 | } |
1270 | 1269 | ||
@@ -1415,7 +1414,7 @@ int uvc_ctrl_get(struct uvc_video_chain *chain, | |||
1415 | 1414 | ||
1416 | ctrl = uvc_find_control(chain, xctrl->id, &mapping); | 1415 | ctrl = uvc_find_control(chain, xctrl->id, &mapping); |
1417 | if (ctrl == NULL) | 1416 | if (ctrl == NULL) |
1418 | return -ENOENT; | 1417 | return -EINVAL; |
1419 | 1418 | ||
1420 | return __uvc_ctrl_get(chain, ctrl, mapping, &xctrl->value); | 1419 | return __uvc_ctrl_get(chain, ctrl, mapping, &xctrl->value); |
1421 | } | 1420 | } |
@@ -1432,10 +1431,8 @@ int uvc_ctrl_set(struct uvc_video_chain *chain, | |||
1432 | int ret; | 1431 | int ret; |
1433 | 1432 | ||
1434 | ctrl = uvc_find_control(chain, xctrl->id, &mapping); | 1433 | ctrl = uvc_find_control(chain, xctrl->id, &mapping); |
1435 | if (ctrl == NULL) | 1434 | if (ctrl == NULL || (ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR) == 0) |
1436 | return -ENOENT; | 1435 | return -EINVAL; |
1437 | if (!(ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR)) | ||
1438 | return -EACCES; | ||
1439 | 1436 | ||
1440 | /* Clamp out of range values. */ | 1437 | /* Clamp out of range values. */ |
1441 | switch (mapping->v4l2_type) { | 1438 | switch (mapping->v4l2_type) { |