diff options
author | Heiko Stuebner <heiko@sntech.de> | 2013-03-06 22:38:13 -0500 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2013-03-06 22:38:13 -0500 |
commit | 502a29890cb10292f464beb802f7184c0d567ab8 (patch) | |
tree | a92cbd51a507171ad0981c12e6f2ca58b4fb525d /arch/arm/mach-s3c24xx | |
parent | d97fedef912832611b668fa7ece8e8ff54a6a590 (diff) |
ARM: S3C24XX: fix redundant checks in the irq mapping function
The check during the parent handling itself was wrong, as it should have
checked for parent_irq_data.
The interrupt controller structs always contain an irq_data array with 32
entries and the only possible error could be a parent_irq assignment of >31.
As this would point to outside the irq_data array this could contain
anything including non-NULL values. Therefore correct this to check
the parent_irq value to be in the right range.
With the same explanation of a valid interrupt controller always having a
full irq_data array, the topmost irq_data check in s3c24xx_irq_map
can also go away.
Finally the mapping function is only called thru the irq_domain ops, in
which case the intc struct is already successfully created, so there is
no need to check for it again.
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-s3c24xx')
-rw-r--r-- | arch/arm/mach-s3c24xx/irq.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/arch/arm/mach-s3c24xx/irq.c b/arch/arm/mach-s3c24xx/irq.c index 3f3de7492094..5257c9fd9e04 100644 --- a/arch/arm/mach-s3c24xx/irq.c +++ b/arch/arm/mach-s3c24xx/irq.c | |||
@@ -324,16 +324,6 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, | |||
324 | struct s3c_irq_data *parent_irq_data; | 324 | struct s3c_irq_data *parent_irq_data; |
325 | unsigned int irqno; | 325 | unsigned int irqno; |
326 | 326 | ||
327 | if (!intc) { | ||
328 | pr_err("irq-s3c24xx: no controller found for hwirq %lu\n", hw); | ||
329 | return -EINVAL; | ||
330 | } | ||
331 | |||
332 | if (!irq_data) { | ||
333 | pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", hw); | ||
334 | return -EINVAL; | ||
335 | } | ||
336 | |||
337 | /* attach controller pointer to irq_data */ | 327 | /* attach controller pointer to irq_data */ |
338 | irq_data->intc = intc; | 328 | irq_data->intc = intc; |
339 | 329 | ||
@@ -383,13 +373,13 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, | |||
383 | goto err; | 373 | goto err; |
384 | } | 374 | } |
385 | 375 | ||
386 | parent_irq_data = &parent_intc->irqs[irq_data->parent_irq]; | 376 | if (irq_data->parent_irq > 31) { |
387 | if (!irq_data) { | 377 | pr_err("irq-s3c24xx: parent irq %lu is out of range\n", |
388 | pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", | 378 | irq_data->parent_irq); |
389 | hw); | ||
390 | goto err; | 379 | goto err; |
391 | } | 380 | } |
392 | 381 | ||
382 | parent_irq_data = &parent_intc->irqs[irq_data->parent_irq]; | ||
393 | parent_irq_data->sub_intc = intc; | 383 | parent_irq_data->sub_intc = intc; |
394 | parent_irq_data->sub_bits |= (1UL << hw); | 384 | parent_irq_data->sub_bits |= (1UL << hw); |
395 | 385 | ||