powerpc/mpic: Use bitmap_zalloc() when applicable
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 17 Dec 2021 21:54:12 +0000 (22:54 +0100)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 20 Dec 2021 00:54:05 +0000 (11:54 +1100)
'mpic->protected' is a bitmap. So use 'bitmap_zalloc()' to simplify
code and improve the semantic, instead of hand writing it.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/aa145f674e08044c98f13f1a985faa9cc29c3708.1639777976.git.christophe.jaillet@wanadoo.fr
arch/powerpc/sysdev/mpic.c

index 995fb2ada507a28ce6c72248d1f77158bd66bc8b..626ba4a9f64f20300c9558136cbccd450a204faf 100644 (file)
@@ -1323,8 +1323,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
        psrc = of_get_property(mpic->node, "protected-sources", &psize);
        if (psrc) {
                /* Allocate a bitmap with one bit per interrupt */
-               unsigned int mapsize = BITS_TO_LONGS(intvec_top + 1);
-               mpic->protected = kcalloc(mapsize, sizeof(long), GFP_KERNEL);
+               mpic->protected = bitmap_zalloc(intvec_top + 1, GFP_KERNEL);
                BUG_ON(mpic->protected == NULL);
                for (i = 0; i < psize/sizeof(u32); i++) {
                        if (psrc[i] > intvec_top)