[PATCH] examples/pipeline: fix build with some compilers

Ali Alnubani alialnu at nvidia.com
Sun Sep 25 11:20:37 CEST 2022


Fixes the following build failure with gcc 5.4.0 because
of uninitialized variables:

[..]
examples/pipeline/cli.c:1801:10: error: 'idx' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
[..]
examples/pipeline/cli.c:1916:10: error: 'idx' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
[..]

Fixes: 83f58a7b7b0a ("examples/pipeline: add commands for direct registers")
Cc: cristian.dumitrescu at intel.com

Signed-off-by: Ali Alnubani <alialnu at nvidia.com>
---
 examples/pipeline/cli.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c
index 35beb1139f..8013541c4b 100644
--- a/examples/pipeline/cli.c
+++ b/examples/pipeline/cli.c
@@ -1786,7 +1786,7 @@ cmd_pipeline_regrd(char **tokens,
 
 	/* index. */
 	if (!strcmp(tokens[4], "index")) {
-		uint32_t idx;
+		uint32_t idx = 0;
 
 		if (n_tokens != 6) {
 			snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
@@ -1901,7 +1901,7 @@ cmd_pipeline_regwr(char **tokens,
 
 	/* index. */
 	if (!strcmp(tokens[6], "index")) {
-		uint32_t idx;
+		uint32_t idx = 0;
 
 		if (n_tokens != 8) {
 			snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
-- 
2.25.1



More information about the dev mailing list