Commit 33e1e5e317b0fc78ac6588ec8aa40005bcddd7ce

Authored by Todd Poynor
Committed by Sekhar Nori
1 parent f299bb9527

ARM: davinci: Check for NULL return from irq_alloc_generic_chip

Avoid NULL dereference of irq_alloc_generic_chip return in low
memory conditions.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>

Showing 1 changed file with 6 additions and 0 deletions Side-by-side Diff

arch/arm/mach-davinci/irq.c
... ... @@ -52,6 +52,12 @@
52 52 struct irq_chip_type *ct;
53 53  
54 54 gc = irq_alloc_generic_chip("AINTC", 1, irq_start, base, handle_edge_irq);
  55 + if (!gc) {
  56 + pr_err("%s: irq_alloc_generic_chip for IRQ %u failed\n",
  57 + __func__, irq_start);
  58 + return;
  59 + }
  60 +
55 61 ct = gc->chip_types;
56 62 ct->chip.irq_ack = irq_gc_ack;
57 63 ct->chip.irq_mask = irq_gc_mask_clr_bit;