[PATCH] net/mlx4: fix unreachable code warnings

Dariusz Sosnowski dsosnowski at nvidia.com
Fri Nov 27 10:09:22 CET 2026


Building with clang and -Wunreachable-code generates warnings
on variable declarations inside switch block in mlx4_flow_prepare().
Move them up to silence the warnings.

Bugzilla ID: 2139
Fixes: 267d07dacdeb ("net/mlx4: tidy up flow rule handling code")
Fixes: 078b8b452e6b ("net/mlx4: add RSS flow rule action support")
Fixes: ac8d22de2394 ("ethdev: flatten RSS configuration in flow API")
Fixes: ef134c8daa08 ("net/mlx4: fix ignored RSS hash types")
Cc: stable at dpdk.org

Reported-by: Stephen Hemminger <stephen at networkplumber.org>
Suggested-by: Stephen Hemminger <stephen at networkplumber.org>
Signed-off-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
---
 drivers/net/mlx4/mlx4_flow.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c
index b520664d95..f812884c34 100644
--- a/drivers/net/mlx4/mlx4_flow.c
+++ b/drivers/net/mlx4/mlx4_flow.c
@@ -747,6 +747,13 @@ mlx4_flow_prepare(struct mlx4_priv *priv,
 	}
 	/* Go over actions list. */
 	for (action = actions; action->type; ++action) {
+		const struct rte_flow_action_queue *queue;
+		const struct rte_flow_action_rss *rss;
+		const uint8_t *rss_key;
+		uint32_t rss_key_len;
+		uint64_t fields;
+		unsigned int i;
+
 		/* This one may appear anywhere multiple times. */
 		if (action->type == RTE_FLOW_ACTION_TYPE_VOID)
 			continue;
@@ -758,13 +765,6 @@ mlx4_flow_prepare(struct mlx4_priv *priv,
 		}
 		overlap = 1;
 		switch (action->type) {
-			const struct rte_flow_action_queue *queue;
-			const struct rte_flow_action_rss *rss;
-			const uint8_t *rss_key;
-			uint32_t rss_key_len;
-			uint64_t fields;
-			unsigned int i;
-
 		case RTE_FLOW_ACTION_TYPE_DROP:
 			flow->drop = 1;
 			break;
-- 
2.43.0



More information about the stable mailing list