Checks
Context | Check | Description |
---|---|---|
ci/checkpatch | warning | coding style issues |
Commit Message
Burakov, Anatoly
June 12, 2024, 3 p.m. UTC
From: Ian Stokes <ian.stokes@intel.com> "count" is the returned value, and in this function, value of "count" and "bit" are the same, so there is no reason why these values should be declared as different types, and for returned value data type to be different. Signed-off-by: Chinh Cao <chinh.t.cao@intel.com> Signed-off-by: Ian Stokes <ian.stokes@intel.com> --- drivers/net/ice/base/ice_bitops.h | 4 ++-- drivers/net/ice/base/ice_switch.c | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ice/base/ice_bitops.h b/drivers/net/ice/base/ice_bitops.h index 3b71c1b7f5..5c17bcb674 100644 --- a/drivers/net/ice/base/ice_bitops.h +++ b/drivers/net/ice/base/ice_bitops.h @@ -418,10 +418,10 @@ ice_bitmap_set(ice_bitmap_t *dst, u16 pos, u16 num_bits) * Note that this function assumes it is operating on a bitmap declared using * ice_declare_bitmap. */ -static inline int +static inline u16 ice_bitmap_hweight(ice_bitmap_t *bm, u16 size) { - int count = 0; + u16 count = 0; u16 bit = 0; while (size > (bit = ice_find_next_bit(bm, size, bit))) { diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index fc9a690b6f..e49b86e009 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -3919,7 +3919,7 @@ static void ice_subscribable_recp_shared(struct ice_hw *hw, u16 rid) { ice_declare_bitmap(sub_bitmap, ICE_MAX_NUM_RECIPES); struct ice_sw_recipe *recps; - u8 i, cnt; + u16 i, cnt; recps = hw->switch_info->recp_list; ice_cp_bitmap(sub_bitmap, recps[rid].r_bitmap, ICE_MAX_NUM_RECIPES); @@ -3944,8 +3944,9 @@ static enum ice_status ice_release_recipe_res(struct ice_hw *hw, { ice_declare_bitmap(r_bitmap, ICE_MAX_NUM_RECIPES); struct ice_switch_info *sw = hw->switch_info; - u8 num_recp, rid, num_prof, prof, i, j; enum ice_status status = ICE_SUCCESS; + u16 num_recp, num_prof; + u8 rid, prof, i, j; num_recp = ice_bitmap_hweight(recp->r_bitmap, ICE_MAX_NUM_RECIPES); for (i = 0; i < num_recp; i++) { @@ -7657,7 +7658,7 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const ice_bitmap_t *profiles, ice_xor_bitmap(free_idx, used_idx, possible_idx, ICE_MAX_FV_WORDS); /* return number of free indexes */ - return (u16)ice_bitmap_hweight(free_idx, ICE_MAX_FV_WORDS); + return ice_bitmap_hweight(free_idx, ICE_MAX_FV_WORDS); } static void ice_set_recipe_index(unsigned long idx, u8 *bitmap) @@ -8377,9 +8378,10 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, struct ice_recp_grp_entry *r_tmp; struct ice_sw_fv_list_entry *tmp; struct ice_sw_recipe *rm; - u8 i, cnt, rid_tmp; + u8 i, rid_tmp; bool is_add = true; int status = ICE_SUCCESS; + u16 cnt; if (!ice_is_prof_rule(rinfo->tun_type) && !lkups_cnt) return ICE_ERR_PARAM;