Skip to contentSkip to conversation

examples/pipeline: fix build with some compilers

PATCH Applied Ali Alnubani 2 participants 2 messages Sep 25, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples/pipeline: fix build with some compilers

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")
---
 examples/pipeline/cli.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
examples/pipeline/cli.c +2 -2
index 35beb1139f..8013541c4b 100644
@@ -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]);
Signature · 1 line
2.25.1
#1 lore raw

25/09/2022 11:20, Ali Alnubani:

Quoted 11 lines

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]
[..]

Quoted 4 lines
Fixes 83f58a7b7b0a ("examples/pipeline: add commands for direct registers")

Applied, thanks.