[PATCH v3 043/129] net/ice/base: correct the return type of ice_bitmap_hweight
Anatoly Burakov
anatoly.burakov at intel.com
Tue Jun 25 13:12:48 CEST 2024
From: Chinh Cao <chinh.t.cao at 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 at intel.com>
Signed-off-by: Ian Stokes <ian.stokes at intel.com>
---
drivers/net/ice/base/ice_bitops.h | 4 ++--
drivers/net/ice/base/ice_switch.c | 3 ++-
2 files changed, 4 insertions(+), 3 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 7e6245bd51..2b4be6d115 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -7464,7 +7464,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)
@@ -8175,6 +8175,7 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
struct ice_sw_recipe *rm;
u8 i;
int status = ICE_SUCCESS;
+ u16 cnt;
if (!ice_is_prof_rule(rinfo->tun_type) && !lkups_cnt)
return ICE_ERR_PARAM;
--
2.43.0
More information about the dev
mailing list