[PATCH] mlx4: Use of macro ARRAY_SIZE() to calculate array size
From: Qianfeng Rong
Date: Thu Jun 19 2025 - 08:48:21 EST
Use of macro ARRAY_SIZE to calculate array size minimizes
the redundant code and improves code reusability.
Signed-off-by: Qianfeng Rong <rongqianfeng@xxxxxxxx>
---
drivers/net/ethernet/mellanox/mlx4/qp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
index 913ed255990f..c2c837187c29 100644
--- a/drivers/net/ethernet/mellanox/mlx4/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
@@ -617,7 +617,7 @@ static int mlx4_create_zones(struct mlx4_dev *dev,
* and A0 steering area size) are such that there are only two subareas -- one
* for RSS and one for RAW_ETH.
*/
- for (k = MLX4_QP_TABLE_ZONE_RSS + 1; k < sizeof(*bitmap)/sizeof((*bitmap)[0]);
+ for (k = MLX4_QP_TABLE_ZONE_RSS + 1; k < ARRAY_SIZE((*bitmap));
k++) {
int size;
u32 offset = start_offset_rss;
--
2.34.1