Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/fq_impl: Use the bitmap API to allocate bitmaps

Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.

It is less verbose and it improves the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/c7bf099af07eb497b02d195906ee8c11fea3b3bd.1657377335.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Christophe JAILLET and committed by
Jakub Kicinski
2b8bf3d6 e7bde1c5

+2 -3
+2 -3
include/net/fq_impl.h
··· 358 358 if (!fq->flows) 359 359 return -ENOMEM; 360 360 361 - fq->flows_bitmap = kcalloc(BITS_TO_LONGS(fq->flows_cnt), sizeof(long), 362 - GFP_KERNEL); 361 + fq->flows_bitmap = bitmap_zalloc(fq->flows_cnt, GFP_KERNEL); 363 362 if (!fq->flows_bitmap) { 364 363 kvfree(fq->flows); 365 364 fq->flows = NULL; ··· 382 383 kvfree(fq->flows); 383 384 fq->flows = NULL; 384 385 385 - kfree(fq->flows_bitmap); 386 + bitmap_free(fq->flows_bitmap); 386 387 fq->flows_bitmap = NULL; 387 388 } 388 389