summaryrefslogtreecommitdiff
path: root/arch/powerpc
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2015-01-23 03:25:06 (GMT)
committerMichael Ellerman <mpe@ellerman.id.au>2015-01-28 04:28:10 (GMT)
commit31494cf3532cfee0bf5c913ac9962971aab7b1d4 (patch)
tree73ebfdceed8b6920cd867c962712dd7bc69953e4 /arch/powerpc
parentc1c3a526bb4ddbec7639a9fb3b84fede25b201d9 (diff)
downloadlinux-31494cf3532cfee0bf5c913ac9962971aab7b1d4.tar.xz
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>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/platforms/powernv/opal.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 933c7fb..18fd4e7 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -708,11 +708,12 @@ static void __init opal_irq_init(struct device_node *dn)
/* Get interrupt property */
irqs = of_get_property(opal_node, "opal-interrupts", &irqlen);
- pr_debug("Found %d interrupts reserved for OPAL\n",
- irqs ? (irqlen / 4) : 0);
+ opal_irq_count = irqs ? (irqlen / 4) : 0;
+ pr_debug("Found %d interrupts reserved for OPAL\n", opal_irq_count);
+ if (!opal_irq_count)
+ return;
/* Install interrupt handlers */
- opal_irq_count = irqlen / 4;
opal_irqs = kzalloc(opal_irq_count * sizeof(unsigned int), GFP_KERNEL);
for (i = 0; irqs && i < opal_irq_count; i++, irqs++) {
unsigned int irq, virq;