DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Manish Kurup <manish.kurup@broadcom.com>
To: dev@dpdk.org
Cc: kishore.padmanabha@broadcom.com,
	Shuanglin Wang <shuanglin.wang@broadcom.com>
Subject: [PATCH] net/bnxt: avoid maybe-uninitialized warning in flow counters
Date: Mon,  5 Oct 2026 18:50:59 -0500	[thread overview]
Message-ID: <20261005235059.27176-1-manish.kurup@broadcom.com> (raw)

From: Shuanglin Wang <shuanglin.wang@broadcom.com>

In ulp_fc_mgr_cntr_set, ulp_fc_mgr_cntr_reset, and
ulp_fc_mgr_cntr_parent_flow_set, sw_cntr_idx was declared without
an initializer. The variable is always written through a pointer by
ulp_fc_mgr_sw_cntr_idx_get before it is read, but GCC
-Wmaybe-uninitialized cannot prove this from the function signature
alone. Initialize sw_cntr_idx to 0 at each declaration to silence
the three build warnings.

Signed-off-by: Shuanglin Wang <shuanglin.wang@broadcom.com>
Signed-off-by: Manish Kurup <manish.kurup@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c
index c765e123fe..4f02dd2c20 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c
@@ -437,7 +437,7 @@ int32_t ulp_fc_mgr_cntr_set(struct bnxt_ulp_context *ctxt, enum tf_dir dir,
 			    enum bnxt_ulp_session_type session_type)
 {
 	struct bnxt_ulp_fc_info *ulp_fc_info;
-	uint32_t sw_cntr_idx;
+	uint32_t sw_cntr_idx = 0;
 
 	ulp_fc_info = bnxt_ulp_cntxt_ptr2_fc_info_get(ctxt);
 	if (!ulp_fc_info)
@@ -473,7 +473,7 @@ int32_t ulp_fc_mgr_cntr_reset(struct bnxt_ulp_context *ctxt, uint8_t dir,
 			      uint32_t hw_cntr_id)
 {
 	struct bnxt_ulp_fc_info *ulp_fc_info;
-	uint32_t sw_cntr_idx;
+	uint32_t sw_cntr_idx = 0;
 
 	ulp_fc_info = bnxt_ulp_cntxt_ptr2_fc_info_get(ctxt);
 	if (!ulp_fc_info)
@@ -691,7 +691,7 @@ int32_t ulp_fc_mgr_cntr_parent_flow_set(struct bnxt_ulp_context *ctxt,
 					uint32_t pc_idx)
 {
 	struct bnxt_ulp_fc_info *ulp_fc_info;
-	uint32_t sw_cntr_idx;
+	uint32_t sw_cntr_idx = 0;
 	int32_t rc = 0;
 
 	ulp_fc_info = bnxt_ulp_cntxt_ptr2_fc_info_get(ctxt);
-- 
2.31.1


                 reply	other threads:[~2026-10-05 23:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261005235059.27176-1-manish.kurup@broadcom.com \
    --to=manish.kurup@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kishore.padmanabha@broadcom.com \
    --cc=shuanglin.wang@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox