From af255cd562aaa72455f9022a26afacd68f3fbf73 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Tue, 4 Aug 2015 16:21:49 +0200 Subject: 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 Signed-off-by: Linus Walleij Acked-by: Hartmut Knaack Signed-off-by: Jonathan Cameron --- tools/iio/lsiio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/iio') 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) return -EINVAL; ret = read_sysfs_string("name", dev_dir_name, name); - if (ret) + if (ret < 0) return ret; printf("Device %03d: %s\n", dev_idx, name); @@ -92,7 +92,7 @@ static int dump_one_trigger(const char *dev_dir_name) return -EINVAL; ret = read_sysfs_string("name", dev_dir_name, name); - if (ret) + if (ret < 0) return ret; printf("Trigger %03d: %s\n", dev_idx, name); -- cgit v1.2.3-59-g8ed1b