提交 deb4d1fd 编写于 作者: C Crestez Dan Leonard 提交者: Jonathan Cameron

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: NCrestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: NJonathan Cameron <jic23@kernel.org>
上级 b9155073
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部