diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-08-04 10:21:49 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-08-12 14:26:22 -0400 |
commit | af255cd562aaa72455f9022a26afacd68f3fbf73 (patch) | |
tree | 0566e2687e90c95bed3c8fdd69b3d82e817207c9 /tools/iio | |
parent | 06d2f6ca5a38abe92f1f3a132b331eee773868c3 (diff) |
iio: lsiio: fix error code handling error
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>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'tools/iio')
-rw-r--r-- | tools/iio/lsiio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/iio/lsiio.c b/tools/iio/lsiio.c index b271a9a796d2..3d650e668252 100644 --- a/tools/iio/lsiio.c +++ b/tools/iio/lsiio.c | |||
@@ -69,7 +69,7 @@ static int dump_one_device(const char *dev_dir_name) | |||
69 | return -EINVAL; | 69 | return -EINVAL; |
70 | 70 | ||
71 | ret = read_sysfs_string("name", dev_dir_name, name); | 71 | ret = read_sysfs_string("name", dev_dir_name, name); |
72 | if (ret) | 72 | if (ret < 0) |
73 | return ret; | 73 | return ret; |
74 | 74 | ||
75 | printf("Device %03d: %s\n", dev_idx, name); | 75 | printf("Device %03d: %s\n", dev_idx, name); |
@@ -92,7 +92,7 @@ static int dump_one_trigger(const char *dev_dir_name) | |||
92 | return -EINVAL; | 92 | return -EINVAL; |
93 | 93 | ||
94 | ret = read_sysfs_string("name", dev_dir_name, name); | 94 | ret = read_sysfs_string("name", dev_dir_name, name); |
95 | if (ret) | 95 | if (ret < 0) |
96 | return ret; | 96 | return ret; |
97 | 97 | ||
98 | printf("Trigger %03d: %s\n", dev_idx, name); | 98 | printf("Trigger %03d: %s\n", dev_idx, name); |