[ARM] gic: Fix gic cascade irq handling

No need for the cascade irq function to have a "fastcall" annotation.
Fix the range checking for valid IRQ numbers - comparing the value
returned by the GIC with NR_IRQS is meaningless since we translate
the GIC irq number to a Linux IRQ number afterwards.

Check the GIC returned IRQ number is within limits first, then add
the IRQ offset, and only then compare with NR_IRQS.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Russell King and committed by
Russell King
0f347bb9 f3270f6e

+9 -11
+9 -11
arch/arm/common/gic.c
··· 125 } 126 #endif 127 128 - static void fastcall gic_handle_cascade_irq(unsigned int irq, 129 - struct irq_desc *desc) 130 { 131 struct gic_chip_data *chip_data = get_irq_data(irq); 132 struct irq_chip *chip = get_irq_chip(irq); 133 - unsigned int cascade_irq; 134 unsigned long status; 135 136 /* primary controller ack'ing */ ··· 139 status = readl(chip_data->cpu_base + GIC_CPU_INTACK); 140 spin_unlock(&irq_controller_lock); 141 142 - cascade_irq = (status & 0x3ff); 143 - if (cascade_irq > 1020) 144 goto out; 145 - if (cascade_irq < 32 || cascade_irq >= NR_IRQS) { 146 - do_bad_IRQ(cascade_irq, desc); 147 - goto out; 148 - } 149 150 - cascade_irq += chip_data->irq_offset; 151 - generic_handle_irq(cascade_irq); 152 153 out: 154 /* primary controller unmasking */
··· 125 } 126 #endif 127 128 + static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc) 129 { 130 struct gic_chip_data *chip_data = get_irq_data(irq); 131 struct irq_chip *chip = get_irq_chip(irq); 132 + unsigned int cascade_irq, gic_irq; 133 unsigned long status; 134 135 /* primary controller ack'ing */ ··· 140 status = readl(chip_data->cpu_base + GIC_CPU_INTACK); 141 spin_unlock(&irq_controller_lock); 142 143 + gic_irq = (status & 0x3ff); 144 + if (gic_irq == 1023) 145 goto out; 146 147 + cascade_irq = gic_irq + chip_data->irq_offset; 148 + if (unlikely(gic_irq < 32 || gic_irq > 1020 || cascade_irq >= NR_IRQS)) 149 + do_bad_IRQ(cascade_irq, desc); 150 + else 151 + generic_handle_irq(cascade_irq); 152 153 out: 154 /* primary controller unmasking */