Commit 31494cf3 authored by Gavin Shan's avatar Gavin Shan Committed by Michael Ellerman

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: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent c1c3a526
...@@ -708,11 +708,12 @@ static void __init opal_irq_init(struct device_node *dn) ...@@ -708,11 +708,12 @@ static void __init opal_irq_init(struct device_node *dn)
/* Get interrupt property */ /* Get interrupt property */
irqs = of_get_property(opal_node, "opal-interrupts", &irqlen); irqs = of_get_property(opal_node, "opal-interrupts", &irqlen);
pr_debug("Found %d interrupts reserved for OPAL\n", opal_irq_count = irqs ? (irqlen / 4) : 0;
irqs ? (irqlen / 4) : 0); pr_debug("Found %d interrupts reserved for OPAL\n", opal_irq_count);
if (!opal_irq_count)
return;
/* Install interrupt handlers */ /* Install interrupt handlers */
opal_irq_count = irqlen / 4;
opal_irqs = kzalloc(opal_irq_count * sizeof(unsigned int), GFP_KERNEL); opal_irqs = kzalloc(opal_irq_count * sizeof(unsigned int), GFP_KERNEL);
for (i = 0; irqs && i < opal_irq_count; i++, irqs++) { for (i = 0; irqs && i < opal_irq_count; i++, irqs++) {
unsigned int irq, virq; unsigned int irq, virq;
......
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