summaryrefslogtreecommitdiffstats
path: root/tools/iio/generic_buffer.c
diff options
context:
space:
mode:
authorHartmut Knaack <knaack.h@gmx.de>2015-05-31 14:39:57 +0200
committerJonathan Cameron <jic23@kernel.org>2015-05-31 18:36:12 +0200
commite83a47cf6a5bdbd3d5677db13ae4df22f5e24b08 (patch)
tree198d19e8b6017c2c83352134fc0bb0bac95bbfb7 /tools/iio/generic_buffer.c
parenttools:iio:generic_buffer: fix check of errno (diff)
downloadlinux-e83a47cf6a5bdbd3d5677db13ae4df22f5e24b08.tar.xz
linux-e83a47cf6a5bdbd3d5677db13ae4df22f5e24b08.zip
tools:iio:generic_buffer: pass up right error code
find_type_by_name() returns a valid error code in case of an error. Pass this code up instead of an artificial one. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'tools/iio/generic_buffer.c')
-rw-r--r--tools/iio/generic_buffer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c
index e01c80ec5a88..419e22736c3a 100644
--- a/tools/iio/generic_buffer.c
+++ b/tools/iio/generic_buffer.c
@@ -202,7 +202,7 @@ int main(int argc, char **argv)
dev_num = find_type_by_name(device_name, "iio:device");
if (dev_num < 0) {
printf("Failed to find the %s\n", device_name);
- ret = -ENODEV;
+ ret = dev_num;
goto error_ret;
}
printf("iio device number being used is %d\n", dev_num);
@@ -228,7 +228,7 @@ int main(int argc, char **argv)
trig_num = find_type_by_name(trigger_name, "trigger");
if (trig_num < 0) {
printf("Failed to find the trigger %s\n", trigger_name);
- ret = -ENODEV;
+ ret = trig_num;
goto error_free_triggername;
}
printf("iio trigger number being used is %d\n", trig_num);