]> git.droids-corp.org - dpdk.git/commitdiff
net/cnxk: fix build with optimization
authorRakesh Kudurumalla <rkudurumalla@marvell.com>
Fri, 4 Mar 2022 14:23:37 +0000 (19:53 +0530)
committerJerin Jacob <jerinj@marvell.com>
Thu, 10 Mar 2022 08:48:11 +0000 (09:48 +0100)
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]

drivers/net/cnxk/cn10k_rx.h:149:2 error: ‘frag_ptr’ may be
used uninitialized in this function

Bugzilla ID: 939
Fixes: b526599020ef ("net/cnxk: fix build with GCC 12")
Cc: stable@dpdk.org
Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
Tested-by: Daxue Gao <daxuex.gao@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
drivers/net/cnxk/cn10k_rx.h
drivers/net/cnxk/cnxk_ethdev_mtr.c

index 7f219e5dddc11a1c00be19386a8783fa9929f919..e4f5a553a6f2ef6564a2bae3bddf91a6ab53402b 100644 (file)
@@ -146,7 +146,8 @@ nix_sec_attach_frags(const struct cpt_parse_hdr_s *hdr,
        uint32_t offset = hdr->w2.fi_offset;
        union nix_rx_parse_u *frag_rx;
        struct cpt_frag_info_s *finfo;
-       uint64_t *frag_ptr, ol_flags;
+       uint64_t *frag_ptr = NULL;
+       uint64_t ol_flags;
        uint16_t frag_size;
        uint16_t rlen;
        uint64_t *wqe;
@@ -276,8 +277,8 @@ nix_sec_reassemble_frags(const struct cpt_parse_hdr_s *hdr, uint64_t cq_w1,
        union nix_rx_parse_u *frag_rx;
        struct cpt_frag_info_s *finfo;
        struct rte_mbuf *head, *mbuf;
+       uint64_t *frag_ptr = NULL;
        rte_iova_t *inner_iova;
-       uint64_t *frag_ptr;
        uint16_t frag_size;
        uint64_t *wqe;
 
index c8183aa12db9ae159d8aab2edd7f92d6e984a20d..02803bdf7540185b85cfc1df6f45d66d4710d6c5 100644 (file)
@@ -288,7 +288,7 @@ cnxk_nix_mtr_profile_delete(struct rte_eth_dev *eth_dev, uint32_t profile_id,
 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:
                if (action) {