Skip to contentSkip to conversation

misc: Fix irq leak in max8997_muic_probe error path

PATCH Superseded Axel Lin 1 participant 1 message Dec 18, 2011 Char and misc drivers

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 misc: Fix irq leak in max8997_muic_probe error path

Current code does not properly free allocated irqs if request_threaded_irq returns error, fix it.

---
 drivers/misc/max8997-muic.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/misc/max8997-muic.c +2 -4
index 74a9448..409b7fc 100644
@@ -566,10 +566,6 @@ static int __devinit max8997_muic_probe(struct platform_device *pdev)
 				"failed: irq request (IRQ: %d,"
 				" error :%d)\n",
 				muic_irq->irq, ret);
-
-			for (i = i - 1; i >= 0; i--)
-				free_irq(muic_irq->irq, info);
-
 			goto err_irq;
 		}
 	}
@@ -583,6 +579,8 @@ static int __devinit max8997_muic_probe(struct platform_device *pdev)
 	return ret;
 
 err_irq:
+	while (--i >= 0)
+		free_irq(pdata->irq_base + muic_irqs[i].irq, info);
 	sysfs_remove_group(&pdev->dev.kobj, &max8997_muic_group);
 err_sysfs:
 err_pdata:
Signature · 1 line
1.7.5.4