From: Shuanglin Wang <[email protected]> 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 <[email protected]> Signed-off-by: Manish Kurup <[email protected]> --- 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

