提交 3f9059b7 编写于 作者: L Linus Walleij 提交者: Jonathan Cameron

iio: percolate error if event fd fails

This makes the error from iio_event_getfd() percolate up
to userspace properly so we can know for sure there is no
events on this device (-ENODEV returned). Before this patch
we would bail out looking for the unsupported events on the
erroneous (negative) file descriptor.
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
Acked-by: NDaniel Baluta <daniel.baluta@intel.com>
Signed-off-by: NJonathan Cameron <jic23@kernel.org>
上级 53dabafe
......@@ -1153,6 +1153,8 @@ static long iio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
if (cmd == IIO_GET_EVENT_FD_IOCTL) {
fd = iio_event_getfd(indio_dev);
if (fd < 0)
return fd;
if (copy_to_user(ip, &fd, sizeof(fd)))
return -EFAULT;
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册