[PATCH v2] firmware: ti_sci: Use devm_bitmap_zalloc when applicable

From: Christophe JAILLET
Date: Thu Nov 03 2022 - 02:41:42 EST


'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@xxxxxxxxxx>
Reviewed-by: Nishanth Menon <nm@xxxxxx>
---
Change in v2:
* sync with -next
* add R-b

v1: https://lore.kernel.org/all/1bd77909ff75f62a2228a39db208c4c6d1b3e0e2.1632659746.git.christophe.jaillet@xxxxxxxxxx/
---
drivers/firmware/ti_sci.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index 6d2fd0ff7ff3..039d92a595ec 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -3398,13 +3398,11 @@ static int ti_sci_probe(struct platform_device *pdev)
if (!minfo->xfer_block)
return -ENOMEM;

- minfo->xfer_alloc_table = devm_kcalloc(dev,
- BITS_TO_LONGS(desc->max_msgs),
- sizeof(unsigned long),
- GFP_KERNEL);
+ minfo->xfer_alloc_table = devm_bitmap_zalloc(dev,
+ desc->max_msgs,
+ GFP_KERNEL);
if (!minfo->xfer_alloc_table)
return -ENOMEM;
- bitmap_zero(minfo->xfer_alloc_table, desc->max_msgs);

/* Pre-initialize the buffer pointer to pre-allocated buffers */
for (i = 0, xfer = minfo->xfer_block; i < desc->max_msgs; i++, xfer++) {
--
2.34.1