summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/uvc/uvc_v4l2.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-12-23 14:39:32 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-23 09:39:14 -0800
commit9c016d61097cc39427a2f5025bdd97ac633d26a6 (patch)
tree3a694f797800c0f3c34fb4f6148c824f64b5ca68 /drivers/media/usb/uvc/uvc_v4l2.c
parenta49f0d1ea3ec94fc7cf33a7c36a16343b74bd565 (diff)
downloadblackbird-obmc-linux-9c016d61097cc39427a2f5025bdd97ac633d26a6.tar.gz
blackbird-obmc-linux-9c016d61097cc39427a2f5025bdd97ac633d26a6.zip
Partly revert "[media] uvcvideo: Set error_idx properly for extended controls API failures"
Commit f0ed2ce840b3 ("[media] uvcvideo: Set error_idx properly for extended controls API failures") causes user space to behave incorrectly on one of my test machines (there is no sound under KDE 4.9.4 using pulseaudio and there is a knotify4 process occupying one of the CPU cores 100% of the time). Reverting that commit entirely fixes the problem for me. However, commit f0ed2ce840b3 appears to do more than it follows from its changelog, because the changelog only says about the changes related to ctrls->error_idx, while the commit additionally changes error codes returned by various functions in uvc_ctrl.c and uvc_v4l2.c. It turns out that the changes of the returned error codes confuse the user spce, so it is sufficient to revert the part of commit f0ed2ce840b3 not mentioned in its changelog to fix the problem. [ 'ENOENT' is not a valid error return from an ioctl to begin with, and I don't understand how anybody ever even thought it would be. - Linus ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Mauro Carvalho Chehab <mchehab@redhat.com> Cc: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/media/usb/uvc/uvc_v4l2.c')
-rw-r--r--drivers/media/usb/uvc/uvc_v4l2.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 8e056046bc20..f2ee8c6b0d8d 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -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;
}
@@ -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)
@@ -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;
@@ -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;
}
}
OpenPOWER on IntegriCloud