summaryrefslogtreecommitdiff
path: root/drivers/misc/cxl/of.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/cxl/of.c')
-rw-r--r--drivers/misc/cxl/of.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/misc/cxl/of.c b/drivers/misc/cxl/of.c
index 1cfecba42d01..25ce725035e7 100644
--- a/drivers/misc/cxl/of.c
+++ b/drivers/misc/cxl/of.c
@@ -308,8 +308,7 @@ static int read_adapter_irq_config(struct cxl *adapter, struct device_node *np)
cur = &adapter->guest->irq_avail[i];
cur->offset = be32_to_cpu(ranges[i * 2]);
cur->range = be32_to_cpu(ranges[i * 2 + 1]);
- cur->bitmap = kcalloc(BITS_TO_LONGS(cur->range),
- sizeof(*cur->bitmap), GFP_KERNEL);
+ cur->bitmap = bitmap_zalloc(cur->range, GFP_KERNEL);
if (cur->bitmap == NULL)
goto err;
if (cur->offset < adapter->guest->irq_base_offset)
@@ -326,7 +325,7 @@ static int read_adapter_irq_config(struct cxl *adapter, struct device_node *np)
err:
for (i--; i >= 0; i--) {
cur = &adapter->guest->irq_avail[i];
- kfree(cur->bitmap);
+ bitmap_free(cur->bitmap);
}
kfree(adapter->guest->irq_avail);
adapter->guest->irq_avail = NULL;