net/ice/base: fix unreachable code usage
authorQi Zhang <qi.z.zhang@intel.com>
Mon, 25 Mar 2019 05:44:41 +0000 (13:44 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 29 Mar 2019 16:25:31 +0000 (17:25 +0100)
Klocwork points out some code is unreachable in
ice_get_itr_intrl_gran and ice_ptg_find_ptype.
The patch removed the unreachable code and resolved the static
analysis reported issues.

Fixes: 51d04e4933e3 ("net/ice/base: add flexible pipeline module")
Fixes: 453d087ccaff ("net/ice/base: add common functions")

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
Reviewed-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
drivers/net/ice/base/ice_common.c
drivers/net/ice/base/ice_flex_pipe.c

index ae0e7fc..2362dd7 100644 (file)
@@ -741,7 +741,7 @@ void ice_output_fw_log(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf)
  * Determines the itr/intrl granularities based on the maximum aggregate
  * bandwidth according to the device's configuration during power-on.
  */
-static enum ice_status ice_get_itr_intrl_gran(struct ice_hw *hw)
+static void ice_get_itr_intrl_gran(struct ice_hw *hw)
 {
        u8 max_agg_bw = (rd32(hw, GL_PWR_MODE_CTL) &
                         GL_PWR_MODE_CTL_CAR_MAX_BW_M) >>
@@ -758,13 +758,7 @@ static enum ice_status ice_get_itr_intrl_gran(struct ice_hw *hw)
                hw->itr_gran = ICE_ITR_GRAN_MAX_25;
                hw->intrl_gran = ICE_INTRL_GRAN_MAX_25;
                break;
-       default:
-               ice_debug(hw, ICE_DBG_INIT,
-                         "Failed to determine itr/intrl granularity\n");
-               return ICE_ERR_CFG;
        }
-
-       return ICE_SUCCESS;
 }
 
 /**
@@ -795,9 +789,7 @@ enum ice_status ice_init_hw(struct ice_hw *hw)
        if (status)
                return status;
 
-       status = ice_get_itr_intrl_gran(hw);
-       if (status)
-               return status;
+       ice_get_itr_intrl_gran(hw);
 
 
        status = ice_init_all_ctrlq(hw);
index 1dd121b..5253780 100644 (file)
@@ -4288,17 +4288,12 @@ ice_add_prof_to_lst(struct ice_hw *hw, enum ice_block blk,
        p->tcam_count = map->ptype_count;
 
        for (i = 0; i < map->ptype_count; i++) {
-               enum ice_status status;
                u8 ptg;
 
                p->tcam[i].prof_id = map->prof_id;
                p->tcam[i].tcam_idx = ICE_INVALID_TCAM;
 
-               status = ice_ptg_find_ptype(hw, blk, map->ptype[i], &ptg);
-               if (status) {
-                       ice_free(hw, p);
-                       return status;
-               }
+               ice_ptg_find_ptype(hw, blk, map->ptype[i], &ptg);
 
                p->tcam[i].ptg = ptg;
        }