Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/powernv: Don't alloc IRQ map if necessary

On PowerNV platform, the OPAL interrupts are exported by firmware
through device-node property (/ibm,opal::opal-interrupts). Under
some extreme circumstances (e.g. simulator), we don't have this
property found from the device tree. For that case, we shouldn't
allocate the interrupt map. Otherwise, slab complains allocating
zero sized memory chunk.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Gavin Shan and committed by
Michael Ellerman
31494cf3 c1c3a526

+4 -3
+4 -3
arch/powerpc/platforms/powernv/opal.c
··· 708 708 709 709 /* Get interrupt property */ 710 710 irqs = of_get_property(opal_node, "opal-interrupts", &irqlen); 711 - pr_debug("Found %d interrupts reserved for OPAL\n", 712 - irqs ? (irqlen / 4) : 0); 711 + opal_irq_count = irqs ? (irqlen / 4) : 0; 712 + pr_debug("Found %d interrupts reserved for OPAL\n", opal_irq_count); 713 + if (!opal_irq_count) 714 + return; 713 715 714 716 /* Install interrupt handlers */ 715 - opal_irq_count = irqlen / 4; 716 717 opal_irqs = kzalloc(opal_irq_count * sizeof(unsigned int), GFP_KERNEL); 717 718 for (i = 0; irqs && i < opal_irq_count; i++, irqs++) { 718 719 unsigned int irq, virq;