mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 23:27:06 +00:00
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 <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/3efaf2784424ae3d7411dc47f8b6b03e7bb8c059.1637702701.git.christophe.jaillet@wanadoo.fr Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
de8f2c0575
commit
d5aeba456e
1 changed files with 2 additions and 4 deletions
|
@ -1042,9 +1042,7 @@ EXPORT_SYMBOL(shdma_cleanup);
|
||||||
|
|
||||||
static int __init shdma_enter(void)
|
static int __init shdma_enter(void)
|
||||||
{
|
{
|
||||||
shdma_slave_used = kcalloc(DIV_ROUND_UP(slave_num, BITS_PER_LONG),
|
shdma_slave_used = bitmap_zalloc(slave_num, GFP_KERNEL);
|
||||||
sizeof(long),
|
|
||||||
GFP_KERNEL);
|
|
||||||
if (!shdma_slave_used)
|
if (!shdma_slave_used)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1053,7 +1051,7 @@ module_init(shdma_enter);
|
||||||
|
|
||||||
static void __exit shdma_exit(void)
|
static void __exit shdma_exit(void)
|
||||||
{
|
{
|
||||||
kfree(shdma_slave_used);
|
bitmap_free(shdma_slave_used);
|
||||||
}
|
}
|
||||||
module_exit(shdma_exit);
|
module_exit(shdma_exit);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue