diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-08-11 11:56:40 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-08-16 11:51:26 +0200 |
commit | 3f9059b71791cf0e57a4879594f0066237976943 (patch) | |
tree | c0209f19fefdc8fa41b23ab201324df3ef2794f8 /drivers/iio | |
parent | iio: generic_buffer: be helpful about enabling channels (diff) | |
download | linux-3f9059b71791cf0e57a4879594f0066237976943.tar.xz linux-3f9059b71791cf0e57a4879594f0066237976943.zip |
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: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/industrialio-core.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index b3fcc2c449d8..b347524d1b6d 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -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; |