Skip to content

Commit 5037c62

Browse files
Dan Carpenterdavem330
authored andcommitted
cnic: tidy up a size calculation
Static checkers complain that id_tbl->table points to longs and 4 bytes is smaller than sizeof(long). But the since other side is dividing by 32 instead of sizeof(long), that means the current code works fine. Anyway, it's more conventional to use the BITS_TO_LONGS() macro when we're allocating a bitmap. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 92291c9 commit 5037c62

File tree

1 file changed

+1
-1
lines changed
  • drivers/net/ethernet/broadcom

1 file changed

+1
-1
lines changed

drivers/net/ethernet/broadcom/cnic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ static int cnic_init_id_tbl(struct cnic_id_tbl *id_tbl, u32 size, u32 start_id,
660660
id_tbl->max = size;
661661
id_tbl->next = next;
662662
spin_lock_init(&id_tbl->lock);
663-
id_tbl->table = kcalloc(DIV_ROUND_UP(size, 32), 4, GFP_KERNEL);
663+
id_tbl->table = kcalloc(BITS_TO_LONGS(size), sizeof(long), GFP_KERNEL);
664664
if (!id_tbl->table)
665665
return -ENOMEM;
666666

0 commit comments

Comments
 (0)