diff options
author | Crestez Dan Leonard <leonard.crestez@intel.com> | 2016-06-03 21:56:29 +0300 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-06-11 17:38:06 +0100 |
commit | deb4d1fdcb5af079896f7ca5e8067e69485f6bdd (patch) | |
tree | 541c9af8d3750d8b82637dc56715012311c5657f /tools/iio | |
parent | b9155073ff5de8ca6f1c40b64abca702a237c4d1 (diff) |
iio: generic_buffer: Fix --trigger-num option
Initialize trig_num to -1 and handle trig_num=0 as a valid id.
Fixes: 7c7e9dad (iio: iio_generic_buffer: Add --trigger-num option)
Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'tools/iio')
-rw-r--r-- | tools/iio/iio_generic_buffer.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c index e8c30521e99c..0e8a1f7a292d 100644 --- a/tools/iio/iio_generic_buffer.c +++ b/tools/iio/iio_generic_buffer.c @@ -341,7 +341,7 @@ int main(int argc, char **argv) char *data = NULL; ssize_t read_size; - int dev_num = -1, trig_num; + int dev_num = -1, trig_num = -1; char *buffer_access = NULL; int scan_size; int noevents = 0; @@ -456,7 +456,7 @@ int main(int argc, char **argv) if (notrigger) { printf("trigger-less mode selected\n"); - } if (trig_num > 0) { + } if (trig_num >= 0) { char *trig_dev_name; ret = asprintf(&trig_dev_name, "%strigger%d", iio_dir, trig_num); if (ret < 0) { |