firmware: ti_sci: Use devm_bitmap_zalloc when applicable
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2183343 'xfer_alloc_table' is a bitmap. So use 'devm_bitmap_zalloc()' to simplify code and improve the semantic of the code. While at it, remove a redundant 'bitmap_zero()' call. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Nishanth Menon <nm@ti.com> Reviewed-by: Nishanth Menon <nm@ti.com> Link: https://lore.kernel.org/r/43ab1a7dd073d0d037d5d4bbbd5f8335de605826.1667457664.git.christophe.jaillet@wanadoo.fr (cherry picked from commit 26507b033e84be6f821dc1693d667b5c809a7679) Signed-off-by: Sebastian Ott <sebott@redhat.com>
This commit is contained in:
parent
1199180ba5
commit
a897874f3b
|
@ -3398,13 +3398,11 @@ static int ti_sci_probe(struct platform_device *pdev)
|
||||||
if (!minfo->xfer_block)
|
if (!minfo->xfer_block)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
minfo->xfer_alloc_table = devm_kcalloc(dev,
|
minfo->xfer_alloc_table = devm_bitmap_zalloc(dev,
|
||||||
BITS_TO_LONGS(desc->max_msgs),
|
desc->max_msgs,
|
||||||
sizeof(unsigned long),
|
GFP_KERNEL);
|
||||||
GFP_KERNEL);
|
|
||||||
if (!minfo->xfer_alloc_table)
|
if (!minfo->xfer_alloc_table)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
bitmap_zero(minfo->xfer_alloc_table, desc->max_msgs);
|
|
||||||
|
|
||||||
/* Pre-initialize the buffer pointer to pre-allocated buffers */
|
/* Pre-initialize the buffer pointer to pre-allocated buffers */
|
||||||
for (i = 0, xfer = minfo->xfer_block; i < desc->max_msgs; i++, xfer++) {
|
for (i = 0, xfer = minfo->xfer_block; i < desc->max_msgs; i++, xfer++) {
|
||||||
|
|
Loading…
Reference in New Issue