Skip to content

Commit ff5fe88

Browse files
andy-shevMarc Zyngier
authored andcommitted
irqchip/gic-v3: Switch to bitmap_zalloc()
Switch to bitmap_zalloc() to show clearly what we are allocating. Besides that it returns pointer of bitmap type instead of opaque void *. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 81d3c9e commit ff5fe88

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

drivers/irqchip/irq-gic-v3-its.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,7 +2140,7 @@ static unsigned long *its_lpi_alloc(int nr_irqs, u32 *base, int *nr_ids)
21402140
if (err)
21412141
goto out;
21422142

2143-
bitmap = kcalloc(BITS_TO_LONGS(nr_irqs), sizeof (long), GFP_ATOMIC);
2143+
bitmap = bitmap_zalloc(nr_irqs, GFP_ATOMIC);
21442144
if (!bitmap)
21452145
goto out;
21462146

@@ -2156,7 +2156,7 @@ static unsigned long *its_lpi_alloc(int nr_irqs, u32 *base, int *nr_ids)
21562156
static void its_lpi_free(unsigned long *bitmap, u32 base, u32 nr_ids)
21572157
{
21582158
WARN_ON(free_lpi_range(base, nr_ids));
2159-
kfree(bitmap);
2159+
bitmap_free(bitmap);
21602160
}
21612161

21622162
static void gic_reset_prop_table(void *va)
@@ -3387,7 +3387,7 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id,
33873387
if (!dev || !itt || !col_map || (!lpi_map && alloc_lpis)) {
33883388
kfree(dev);
33893389
kfree(itt);
3390-
kfree(lpi_map);
3390+
bitmap_free(lpi_map);
33913391
kfree(col_map);
33923392
return NULL;
33933393
}

drivers/irqchip/irq-gic-v3-mbi.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,7 @@ int __init mbi_init(struct fwnode_handle *fwnode, struct irq_domain *parent)
290290
if (ret)
291291
goto err_free_mbi;
292292

293-
mbi_ranges[n].bm = kcalloc(BITS_TO_LONGS(mbi_ranges[n].nr_spis),
294-
sizeof(long), GFP_KERNEL);
293+
mbi_ranges[n].bm = bitmap_zalloc(mbi_ranges[n].nr_spis, GFP_KERNEL);
295294
if (!mbi_ranges[n].bm) {
296295
ret = -ENOMEM;
297296
goto err_free_mbi;
@@ -329,7 +328,7 @@ int __init mbi_init(struct fwnode_handle *fwnode, struct irq_domain *parent)
329328
err_free_mbi:
330329
if (mbi_ranges) {
331330
for (n = 0; n < mbi_range_nr; n++)
332-
kfree(mbi_ranges[n].bm);
331+
bitmap_free(mbi_ranges[n].bm);
333332
kfree(mbi_ranges);
334333
}
335334

0 commit comments

Comments
 (0)