Skip to content

Commit d5aeba4

Browse files
tititiou36vinodkoul
authored andcommitted
dmaengine: sh: Use bitmap_zalloc() when applicable
'shdma_slave_used' is a bitmap. So use 'bitmap_zalloc()' to simplify code, improve the semantic and avoid some open-coded arithmetic in allocator arguments. Also change the corresponding 'kfree()' into 'bitmap_free()' to keep consistency. Signed-off-by: Christophe JAILLET <[email protected]> Link: https://lore.kernel.org/r/3efaf2784424ae3d7411dc47f8b6b03e7bb8c059.1637702701.git.christophe.jaillet@wanadoo.fr Signed-off-by: Vinod Koul <[email protected]>
1 parent de8f2c0 commit d5aeba4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/dma/sh/shdma-base.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,9 +1042,7 @@ EXPORT_SYMBOL(shdma_cleanup);
10421042

10431043
static int __init shdma_enter(void)
10441044
{
1045-
shdma_slave_used = kcalloc(DIV_ROUND_UP(slave_num, BITS_PER_LONG),
1046-
sizeof(long),
1047-
GFP_KERNEL);
1045+
shdma_slave_used = bitmap_zalloc(slave_num, GFP_KERNEL);
10481046
if (!shdma_slave_used)
10491047
return -ENOMEM;
10501048
return 0;
@@ -1053,7 +1051,7 @@ module_init(shdma_enter);
10531051

10541052
static void __exit shdma_exit(void)
10551053
{
1056-
kfree(shdma_slave_used);
1054+
bitmap_free(shdma_slave_used);
10571055
}
10581056
module_exit(shdma_exit);
10591057

0 commit comments

Comments
 (0)