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 <[email protected]>
---
 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

Reply via email to