DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/bnxt: avoid maybe-uninitialized warning in flow counters
@ 2026-10-05 23:50 Manish Kurup
  0 siblings, 0 replies; only message in thread
From: Manish Kurup @ 2026-10-05 23:50 UTC (permalink / raw)
  To: dev; +Cc: kishore.padmanabha, Shuanglin Wang

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-05 23:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-05 23:50 [PATCH] net/bnxt: avoid maybe-uninitialized warning in flow counters Manish Kurup

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox