lkml.org 
[lkml]   [2021]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH] net/mlx4: Use ARRAY_SIZE to get an array's size
    From
    Date


    On 8/18/2021 3:39 AM, Joe Perches wrote:
    > On Tue, 2021-08-17 at 20:11 +0800, Jason Wang wrote:
    >> The ARRAY_SIZE macro is defined to get an array's size which is
    >> more compact and more formal in linux source. Thus, we can replace
    >> the long sizeof(arr)/sizeof(arr[0]) with the compact ARRAY_SIZE.
    > []
    >> diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
    > []
    >> @@ -739,7 +739,7 @@ static void mlx4_cleanup_qp_zones(struct mlx4_dev *dev)
    >>   int i;
    >>
    >>
    >>   for (i = 0;
    >> - i < sizeof(qp_table->zones_uids)/sizeof(qp_table->zones_uids[0]);
    >> + i < ARRAY_SIZE(qp_table->zones_uids);
    >>   i++) {
    >
    > trivia: could now be a single line
    >
    > for (i = 0; i < ARRAY_SIZE(qp_table->zones_uids); i++) {
    >
    >

    I'm fine with both suggestions.
    Reviewed-by: Tariq Toukan <tariqt@nvidia.com>

    Thanks for your patch.
    Tariq

    \
     
     \ /
      Last update: 2021-08-18 14:28    [W:3.760 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site