All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hartmut Knaack <knaack.h@gmx.de>
To: Linus Walleij <linus.walleij@linaro.org>,
	Jonathan Cameron <jic23@kernel.org>,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: lsiio: fix error code handling error
Date: Tue, 04 Aug 2015 22:07:34 +0200	[thread overview]
Message-ID: <55C11B86.3090401@gmx.de> (raw)
In-Reply-To: <1438698109-12356-1-git-send-email-linus.walleij@linaro.org>

Linus Walleij schrieb am 04.08.2015 um 16:21:
> commit acf50b3586f8d8a7530b905e111dda41876d38f4
> "tools:iio:lsiio: add error handling"
> introduced error handling of errors returned from
> read_sysfs_string(), but with a simple if (retval),
> missing the fact that these functions return a positive
> value if the read was successful.
> 
> As a result lsiio regresses and does not show any
> devices on my filesystem. Fix this by checking for
> only negative error codes.
> 
> Cc: Hartmut Knaack <knaack.h@gmx.de>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
> ---
>  tools/iio/lsiio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/iio/lsiio.c b/tools/iio/lsiio.c
> index b59ee1733924..b2c028cc7cac 100644
> --- a/tools/iio/lsiio.c
> +++ b/tools/iio/lsiio.c
> @@ -70,7 +70,7 @@ static int dump_one_device(const char *dev_dir_name)
>  	if (retval != 1)
>  		return -EINVAL;
>  	retval = read_sysfs_string("name", dev_dir_name, name);
> -	if (retval)
> +	if (retval < 0)
>  		return retval;
>  
>  	printf("Device %03d: %s\n", dev_idx, name);
> @@ -91,7 +91,7 @@ static int dump_one_trigger(const char *dev_dir_name)
>  	if (retval != 1)
>  		return -EINVAL;
>  	retval = read_sysfs_string("name", dev_dir_name, name);
> -	if (retval)
> +	if (retval < 0)
>  		return retval;
>  
>  	printf("Trigger %03d: %s\n", dev_idx, name);
> 


  reply	other threads:[~2015-08-04 20:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04 14:21 [PATCH] iio: lsiio: fix error code handling error Linus Walleij
2015-08-04 20:07 ` Hartmut Knaack [this message]
2015-08-08 15:07   ` Jonathan Cameron

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=55C11B86.3090401@gmx.de \
    --to=knaack.h@gmx.de \
    --cc=jic23@kernel.org \
    --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.