From: Linus Walleij <linus.walleij@linaro.org>
To: Jonathan Cameron <jic23@kernel.org>, linux-iio@vger.kernel.org
Cc: Linus Walleij <linus.walleij@linaro.org>,
Hartmut Knaack <knaack.h@gmx.de>
Subject: [PATCH] iio: lsiio: fix error code handling error
Date: Tue, 4 Aug 2015 16:21:49 +0200 [thread overview]
Message-ID: <1438698109-12356-1-git-send-email-linus.walleij@linaro.org> (raw)
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>
---
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);
--
2.4.3
next reply other threads:[~2015-08-04 14:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-04 14:21 Linus Walleij [this message]
2015-08-04 20:07 ` [PATCH] iio: lsiio: fix error code handling error Hartmut Knaack
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=1438698109-12356-1-git-send-email-linus.walleij@linaro.org \
--to=linus.walleij@linaro.org \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--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).