Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 502a2989 authored by Heiko Stuebner's avatar Heiko Stuebner Committed by Kukjin Kim
Browse files

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: default avatarJulia Lawall <julia.lawall@lip6.fr>
Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
Signed-off-by: default avatarKukjin Kim <kgene.kim@samsung.com>
parent d97fedef
Loading
Loading
Loading
Loading
+4 −14
Original line number Diff line number Diff line
@@ -324,16 +324,6 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq,
	struct s3c_irq_data *parent_irq_data;
	unsigned int irqno;

	if (!intc) {
		pr_err("irq-s3c24xx: no controller found for hwirq %lu\n", hw);
		return -EINVAL;
	}

	if (!irq_data) {
		pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", hw);
		return -EINVAL;
	}

	/* attach controller pointer to irq_data */
	irq_data->intc = intc;

@@ -383,13 +373,13 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq,
			goto err;
		}

		parent_irq_data = &parent_intc->irqs[irq_data->parent_irq];
		if (!irq_data) {
			pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n",
			       hw);
		if (irq_data->parent_irq > 31) {
			pr_err("irq-s3c24xx: parent irq %lu is out of range\n",
			       irq_data->parent_irq);
			goto err;
		}

		parent_irq_data = &parent_intc->irqs[irq_data->parent_irq];
		parent_irq_data->sub_intc = intc;
		parent_irq_data->sub_bits |= (1UL << hw);