ice: Reduce scope of variables
authorTony Nguyen <anthony.l.nguyen@intel.com>
Wed, 23 Nov 2022 16:56:40 +0000 (08:56 -0800)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 19 Jan 2023 16:18:03 +0000 (08:18 -0800)
There are some places where the scope of a variable can
be reduced, so do that.

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
drivers/net/ethernet/intel/ice/ice_flex_pipe.c
drivers/net/ethernet/intel/ice/ice_sched.c

index fc74bfc..5ce4139 100644 (file)
@@ -391,10 +391,11 @@ ice_upd_dvm_boost_entry_err:
  */
 int ice_set_dvm_boost_entries(struct ice_hw *hw)
 {
-       int status;
        u16 i;
 
        for (i = 0; i < hw->dvm_upd.count; i++) {
+               int status;
+
                status = ice_upd_dvm_boost_entry(hw, &hw->dvm_upd.tbl[i]);
                if (status)
                        return status;
@@ -3195,12 +3196,13 @@ ice_rem_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig,
        u16 idx = vsig & ICE_VSIG_IDX_M;
        struct ice_vsig_vsi *vsi_cur;
        struct ice_vsig_prof *d, *t;
-       int status;
 
        /* remove TCAM entries */
        list_for_each_entry_safe(d, t,
                                 &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst,
                                 list) {
+               int status;
+
                status = ice_rem_prof_id(hw, blk, d);
                if (status)
                        return status;
@@ -3251,12 +3253,13 @@ ice_rem_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, u64 hdl,
 {
        u16 idx = vsig & ICE_VSIG_IDX_M;
        struct ice_vsig_prof *p, *t;
-       int status;
 
        list_for_each_entry_safe(p, t,
                                 &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst,
                                 list)
                if (p->profile_cookie == hdl) {
+                       int status;
+
                        if (ice_vsig_prof_id_count(hw, blk, vsig) == 1)
                                /* this is the last profile, remove the VSIG */
                                return ice_rem_vsig(hw, blk, vsig, chg);
index 70568f8..4eca8d1 100644 (file)
@@ -1654,12 +1654,13 @@ ice_sched_add_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,
        u32 first_node_teid;
        u16 num_added = 0;
        u8 i, qgl, vsil;
-       int status;
 
        qgl = ice_sched_get_qgrp_layer(hw);
        vsil = ice_sched_get_vsi_layer(hw);
        parent = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
        for (i = vsil + 1; i <= qgl; i++) {
+               int status;
+
                if (!parent)
                        return -EIO;
 
@@ -1755,13 +1756,14 @@ ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_handle,
        u32 first_node_teid;
        u16 num_added = 0;
        u8 i, vsil;
-       int status;
 
        if (!pi)
                return -EINVAL;
 
        vsil = ice_sched_get_vsi_layer(pi->hw);
        for (i = pi->hw->sw_entry_point_layer; i <= vsil; i++) {
+               int status;
+
                status = ice_sched_add_nodes_to_layer(pi, tc_node, parent,
                                                      i, num_nodes[i],
                                                      &first_node_teid,