Skip to contentSkip to conversation

PCI: tegra: add missing cleanup in error path and teardown_irq

PATCH Superseded Jisheng Zhang 1 participant 1 message Jul 25, 2014

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: tegra: add missing cleanup in error path and teardown_irq

We should call tegra_msi_free() to free the msi bit if irq_create_mapping() fails. And we need to dispose the irq mapping during irq teardown.

---
 drivers/pci/host/pci-tegra.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/pci/host/pci-tegra.c +4 -1
index 083cf37..695e7b9 100644
@@ -1203,8 +1203,10 @@ static int tegra_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev,
 		return hwirq;
 
 	irq = irq_create_mapping(msi->domain, hwirq);
-	if (!irq)
+	if (!irq) {
+		tegra_msi_free(msi, hwirq);
 		return -EINVAL;
+	}
 
 	irq_set_msi_desc(irq, desc);
 
@@ -1223,6 +1225,7 @@ static void tegra_msi_teardown_irq(struct msi_chip *chip, unsigned int irq)
 	struct tegra_msi *msi = to_tegra_msi(chip);
 	struct irq_data *d = irq_get_irq_data(irq);
 
+	irq_dispose_mapping(irq);
 	tegra_msi_free(msi, d->hwirq);
 }
 
Signature · 1 line
2.0.1