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

gpu: host1x: 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.

While at it, remove a useless bitmap_zero() call. The bitmap is already
zero'ed when allocated.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Thierry Reding <treding@nvidia.com>

authored by

Christophe JAILLET and committed by
Thierry Reding
2e1bfb31 8c92243d

+2 -6
+2 -6
drivers/gpu/host1x/channel.c
··· 21 21 if (!chlist->channels) 22 22 return -ENOMEM; 23 23 24 - chlist->allocated_channels = 25 - kcalloc(BITS_TO_LONGS(num_channels), sizeof(unsigned long), 26 - GFP_KERNEL); 24 + chlist->allocated_channels = bitmap_zalloc(num_channels, GFP_KERNEL); 27 25 if (!chlist->allocated_channels) { 28 26 kfree(chlist->channels); 29 27 return -ENOMEM; 30 28 } 31 - 32 - bitmap_zero(chlist->allocated_channels, num_channels); 33 29 34 30 return 0; 35 31 } 36 32 37 33 void host1x_channel_list_free(struct host1x_channel_list *chlist) 38 34 { 39 - kfree(chlist->allocated_channels); 35 + bitmap_free(chlist->allocated_channels); 40 36 kfree(chlist->channels); 41 37 } 42 38