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>
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);
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);