Skip to content

Commit 68d6f84

Browse files
pinchartlMauro Carvalho Chehab
authored andcommitted
[media] uvcvideo: Set error_idx properly for S_EXT_CTRLS failures
The uvc_set_ctrl() calls don't write to the hardware. A failure at that point thus leaves the device in a clean state, with no control modified. Set the error_idx field to the count value to reflect that, as per the V4L2 specification. TRY_EXT_CTRLS is unchanged and the error_idx field must always be set to the failed control index in that case. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
1 parent 29005c0 commit 68d6f84

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/media/usb/uvc/uvc_v4l2.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
685685
ret = uvc_ctrl_set(chain, ctrl);
686686
if (ret < 0) {
687687
uvc_ctrl_rollback(handle);
688-
ctrls->error_idx = i;
688+
ctrls->error_idx = cmd == VIDIOC_S_EXT_CTRLS
689+
? ctrls->count : i;
689690
return ret;
690691
}
691692
}

0 commit comments

Comments
 (0)