Skip to contentSkip to conversation

irqchip: renesas-irqc: Fix irqc_probe error handling

PATCH In review Axel Lin 2 participants 2 messages May 6, 2013 – May 8, 2013 irqchip drivers

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 irqchip: renesas-irqc: Fix irqc_probe error handling

The code in goto err3 path is wrong because it will call fee_irq() with k == 0, which means it does free_irq(p->irq[-1].requested_irq, &p->irq[-1]);

---
 drivers/irqchip/irq-renesas-irqc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/irqchip/irq-renesas-irqc.c +2 -2
index 649cd69..3651f77 100644
@@ -252,8 +252,8 @@ static int irqc_probe(struct platform_device *pdev)
 
 	return 0;
 err3:
-	for (; k >= 0; k--)
-		free_irq(p->irq[k - 1].requested_irq, &p->irq[k - 1]);
+	while (--k >= 0)
+		free_irq(p->irq[k].requested_irq, &p->irq[k]);
 
 	irq_domain_remove(p->irq_domain);
 err2:
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 7 lines · Axel Lin

The code in goto err3 path is wrong because it will call fee_irq() with k == 0, which means it does free_irq(p->irq[-1].requested_irq, &p->irq[-1]);

---
 drivers/irqchip/irq-renesas-irqc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Thanks, I have queued this up for v3.11 in the intc-external-irq branch of my renesas tree on kernel.org.

Quoted 21 lines
drivers/irqchip/irq-renesas-irqc.c +2 -2
index 649cd69..3651f77 100644
@@ -252,8 +252,8 @@ static int irqc_probe(struct platform_device *pdev)
 
 	return 0;
 err3:
-	for (; k >= 0; k--)
-		free_irq(p->irq[k - 1].requested_irq, &p->irq[k - 1]);
+	while (--k >= 0)
+		free_irq(p->irq[k].requested_irq, &p->irq[k]);
 
 	irq_domain_remove(p->irq_domain);
 err2:
Signature · 1 line
1.8.1.2