Skip to contentSkip to conversation

app/testpmd: fix flex item compilation error

PATCH Applied Rongwei Liu 2 participants 2 messages Feb 21, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 app/testpmd: fix flex item compilation error

When configuring meson with option "--optimization=1", gcc complains "maybe-uninitialized" warning and it was treated as error since Werror is enabled.

Assign fp to NULL at declaration can avoid this.

Bugzilla ID: 1163

Fixes c8e25fbf1440 ("ethdev: add flow flex modify")
---
 app/test-pmd/cmdline_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/cmdline_flow.c +1 -1
index f1991a5a9a..9309607f11 100644
@@ -8992,7 +8992,7 @@ parse_vc_modify_field_level(struct context *ctx, const struct token *token,
 			 unsigned int size)
 {
 	struct rte_flow_action_modify_field *action;
-	struct flex_item *fp;
+	struct flex_item *fp = NULL;
 	uint32_t val;
 	struct buffer *out = buf;
 	char *end;
Signature · 1 line
2.27.0
#1 lore raw

21/02/2023 11:02, Rongwei Liu:

Quoted 5 lines

When configuring meson with option "--optimization=1", gcc complains "maybe-uninitialized" warning and it was treated as error since Werror is enabled.

Assign fp to NULL at declaration can avoid this.

That's probably a false positive,
but I'm OK to workaround it this way, especially in a test application.

app/test-pmd/cmdline_flow.c parse_vc_modify_field_level(struct context *ctx, const struct token *token, · line 8995

Quoted 9 lines

Bugzilla ID: 1163

Fixes c8e25fbf1440 ("ethdev: add flow flex modify")

---

app/test-pmd/cmdline_flow.c +1 -1
-	struct flex_item *fp;
+	struct flex_item *fp = NULL;

Applied, thanks.