[PATCH] common/cnxk: fix uninitialized pointers in NPA context dump

Nawal Kishor nkishor at marvell.com
Fri Oct 30 06:50:03 CET 2026


In roc_npa_ctx_dump(), rsp and rsp_cn20k are only set through
mbox_process_msg() in separate branches, while the dump code that reads
them selects the pointer in a different branch. The compiler cannot
prove that the pointer being read was set, and warns about a possibly
uninitialized variable.

Initialize both pointers to NULL.

Fixes: a7cc84c6e9e5 ("common/cnxk: support HALO in NPA")

Signed-off-by: Nawal Kishor <nkishor at marvell.com>
---
 drivers/common/cnxk/roc_npa_debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/common/cnxk/roc_npa_debug.c b/drivers/common/cnxk/roc_npa_debug.c
index f978be9642..e2b50ae1c3 100644
--- a/drivers/common/cnxk/roc_npa_debug.c
+++ b/drivers/common/cnxk/roc_npa_debug.c
@@ -249,9 +249,9 @@ npa_cn20k_aura_dump(__io struct npa_cn20k_aura_s *aura)
 int
 roc_npa_ctx_dump(void)
 {
+	struct npa_cn20k_aq_enq_rsp *rsp_cn20k = NULL;
 	struct npa_cn20k_aq_enq_req *aq_cn20k;
-	struct npa_cn20k_aq_enq_rsp *rsp_cn20k;
-	struct npa_aq_enq_rsp *rsp;
+	struct npa_aq_enq_rsp *rsp = NULL;
 	struct npa_aq_enq_req *aq;
 	struct mbox *mbox;
 	struct npa_lf *lf;
-- 
2.48.1



More information about the dev mailing list