linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Hartmut Knaack <knaack.h@gmx.de>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: lsiio: fix error code handling error
Date: Sat, 8 Aug 2015 16:07:06 +0100	[thread overview]
Message-ID: <55C61B1A.9020003@kernel.org> (raw)
In-Reply-To: <55C11B86.3090401@gmx.de>

On 04/08/15 21:07, Hartmut Knaack wrote:
> 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>
Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan
>> ---
>>  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);
>>
> 
> --
> 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-08 15: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
2015-08-08 15:07   ` Jonathan Cameron [this message]

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=55C61B1A.9020003@kernel.org \
    --to=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).