[libgpiod] gpiomon: initialize the active low variable

Message ID 20180122161213.3076-2-clemens.gruber@pqgruber.com
State New
Headers show
Series
  • [libgpiod] gpiomon: initialize the active low variable
Related show

Commit Message

Clemens Gruber Jan. 22, 2018, 4:12 p.m.
The variable active_low is not initialized, so the value is undefined
and if the -l argument is not passed, the undefined value remains.
Fix it by initializing it to false.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 src/tools/gpiomon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bartosz Golaszewski Jan. 23, 2018, 10:20 a.m. | #1
2018-01-22 17:12 GMT+01:00 Clemens Gruber <clemens.gruber@pqgruber.com>:
> The variable active_low is not initialized, so the value is undefined
> and if the -l argument is not passed, the undefined value remains.
> Fix it by initializing it to false.
>
> Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
> ---
>  src/tools/gpiomon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/tools/gpiomon.c b/src/tools/gpiomon.c
> index ad25815..5e68a4f 100644
> --- a/src/tools/gpiomon.c
> +++ b/src/tools/gpiomon.c
> @@ -249,9 +249,9 @@ int main(int argc, char **argv)
>         unsigned int offsets[GPIOD_LINE_BULK_MAX_LINES];
>         struct timespec timeout = { 10, 0 };
>         unsigned int num_lines = 0, offset;
> +       bool active_low = false;
>         int optc, opti, ret, i;
>         struct mon_ctx ctx;
> -       bool active_low;
>         char *end;
>
>         memset(&ctx, 0, sizeof(ctx));
> --
> 2.16.0
>

Applied, thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/src/tools/gpiomon.c b/src/tools/gpiomon.c
index ad25815..5e68a4f 100644
--- a/src/tools/gpiomon.c
+++ b/src/tools/gpiomon.c
@@ -249,9 +249,9 @@  int main(int argc, char **argv)
 	unsigned int offsets[GPIOD_LINE_BULK_MAX_LINES];
 	struct timespec timeout = { 10, 0 };
 	unsigned int num_lines = 0, offset;
+	bool active_low = false;
 	int optc, opti, ret, i;
 	struct mon_ctx ctx;
-	bool active_low;
 	char *end;
 
 	memset(&ctx, 0, sizeof(ctx));