[PATCH 21.11] net/cnxk: fix build with optimization

Kevin Traynor ktraynor at redhat.com
Wed Apr 13 14:05:11 CEST 2022


From: Rakesh Kudurumalla <rkudurumalla at marvell.com>

[upstream commit 68f8a52a6b0ad6b77772d4564928aebb21c2ca66 ]

Fix the following build error seen with --optimization=1 and
GCC 10.3.0.

drivers/net/cnxk/cnxk_ethdev_mtr.c: In function
‘cnxk_nix_mtr_policy_validate’:
lib/ethdev/rte_mtr_driver.h:188:10: error: ‘str’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]

Bugzilla ID: 939
Bugzilla ID: 992
Fixes: b526599020ef ("net/cnxk: fix build with GCC 12")

Reported-by: Ferruh Yigit <ferruh.yigit at intel.com>
Signed-off-by: Rakesh Kudurumalla <rkudurumalla at marvell.com>
---
 drivers/net/cnxk/cnxk_ethdev_mtr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c b/drivers/net/cnxk/cnxk_ethdev_mtr.c
index 6d14c88e7d..b6ccccdc39 100644
--- a/drivers/net/cnxk/cnxk_ethdev_mtr.c
+++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c
@@ -281,5 +281,5 @@ static int
 update_mtr_err(uint32_t act_color, struct rte_mtr_error *error, bool action)
 {
-	const char *str;
+	const char *str = NULL;
 	switch (act_color) {
 	case RTE_COLOR_GREEN:
-- 
2.34.1



More information about the stable mailing list