* [PATCH] iio: generic_buffer: Fix --trigger-num option
@ 2016-06-03 18:56 Crestez Dan Leonard
2016-06-11 16:38 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Crestez Dan Leonard @ 2016-06-03 18:56 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio
Cc: linux-kernel, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, Daniel Baluta, Crestez Dan Leonard
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>
---
tools/iio/iio_generic_buffer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c
index e8c3052..0e8a1f7 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) {
--
2.5.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: generic_buffer: Fix --trigger-num option
2016-06-03 18:56 [PATCH] iio: generic_buffer: Fix --trigger-num option Crestez Dan Leonard
@ 2016-06-11 16:38 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2016-06-11 16:38 UTC (permalink / raw)
To: Crestez Dan Leonard, linux-iio
Cc: linux-kernel, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, Daniel Baluta
On 03/06/16 19:56, Crestez Dan Leonard wrote:
> Initialize trig_num to -1 and handle trig_num=0 as a valid id.
Good spot.
Applied to the togreg branch of iio.git.
Thanks,
Jonathan
>
> Fixes: 7c7e9dad (iio: iio_generic_buffer: Add --trigger-num option)
> Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
> ---
> tools/iio/iio_generic_buffer.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c
> index e8c3052..0e8a1f7 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) {
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-11 16:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-03 18:56 [PATCH] iio: generic_buffer: Fix --trigger-num option Crestez Dan Leonard
2016-06-11 16:38 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).