Commit 2fe4ca6a authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Michael Ellerman

powerpc/mpic: Use bitmap_zalloc() when applicable

'mpic->protected' is a bitmap. So use 'bitmap_zalloc()' to simplify
code and improve the semantic, instead of hand writing it.
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/aa145f674e08044c98f13f1a985faa9cc29c3708.1639777976.git.christophe.jaillet@wanadoo.fr
parent 18678591
...@@ -1323,8 +1323,7 @@ struct mpic * __init mpic_alloc(struct device_node *node, ...@@ -1323,8 +1323,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
psrc = of_get_property(mpic->node, "protected-sources", &psize); psrc = of_get_property(mpic->node, "protected-sources", &psize);
if (psrc) { if (psrc) {
/* Allocate a bitmap with one bit per interrupt */ /* Allocate a bitmap with one bit per interrupt */
unsigned int mapsize = BITS_TO_LONGS(intvec_top + 1); mpic->protected = bitmap_zalloc(intvec_top + 1, GFP_KERNEL);
mpic->protected = kcalloc(mapsize, sizeof(long), GFP_KERNEL);
BUG_ON(mpic->protected == NULL); BUG_ON(mpic->protected == NULL);
for (i = 0; i < psize/sizeof(u32); i++) { for (i = 0; i < psize/sizeof(u32); i++) {
if (psrc[i] > intvec_top) if (psrc[i] > intvec_top)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment