diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2022-07-11 22:14:38 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-07-14 17:53:52 +0300 |
commit | 4b00b176b3a3bcd4679487c23d333be02e533d93 (patch) | |
tree | 691927363832f5fa0cbff8c0cfaaabec43d87cfd /drivers/misc/cxl/of.c | |
parent | d618072d86fcc391b77ca0a1909b5f0bb8423f6e (diff) | |
download | linux-4b00b176b3a3bcd4679487c23d333be02e533d93.tar.xz |
cxl: Use the bitmap API to allocate bitmaps
Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.
It is less verbose and it improves the semantic.
Acked-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/59010cc7c62443030c69cb1ce0b2b62c5d47e064.1657566849.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/cxl/of.c')
-rw-r--r-- | drivers/misc/cxl/of.c | 5 |
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; |