On Tue, Aug 11, 2015 at 12:56 PM, Linus Walleij <linus.walleij@xxxxxxxxxx> wrote: > 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 evens on the > erroneous (negative) file descriptor. Good catch. s/evens/events > > Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx> Acked-by: Daniel Baluta <daniel.baluta@xxxxxxxxx> > --- > drivers/iio/industrialio-core.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c > index 3524b0de8721..9492aa443a26 100644 > --- a/drivers/iio/industrialio-core.c > +++ b/drivers/iio/industrialio-core.c > @@ -1130,6 +1130,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; > -- > 2.4.3 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html