All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Daniel Baluta <daniel.baluta@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH] iio: percolate error if event fd fails
Date: Sat, 15 Aug 2015 16:22:40 +0100	[thread overview]
Message-ID: <55CF5940.9000607@kernel.org> (raw)
In-Reply-To: <CAEnQRZCen5ewAnnuiTSwQ5Yynpx0=_xnb0EUFohqb+v9LhZjzA@mail.gmail.com>

On 11/08/15 11:52, Daniel Baluta wrote:
> On Tue, Aug 11, 2015 at 12:56 PM, Linus Walleij
> <linus.walleij@linaro.org> 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@linaro.org>
> 
> Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Applied to the togreg branch of iio.git.   Initially pushed
out as testing.  I'm not sending this as a fix as the error
that resulted was downright missleading, but unlikely to
have caused any nasty crashes or similar.

If you think if should be going in faster/ for stable then
let me know.

Jonathan
> 
>> ---
>>  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@vger.kernel.org
>> 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@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


  reply	other threads:[~2015-08-15 15:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-11  9:56 [PATCH] iio: percolate error if event fd fails Linus Walleij
2015-08-11 10:52 ` Daniel Baluta
2015-08-15 15:22   ` Jonathan Cameron [this message]
2015-08-17  8:22     ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55CF5940.9000607@kernel.org \
    --to=jic23@kernel.org \
    --cc=daniel.baluta@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.