PCI: tegra: add missing cleanup in error path and teardown_irq
Subsystems (2)
PATCH v2 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/pci/host/pci-tegra.c +6 -2
@@ -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);
@@ -1222,8 +1224,10 @@ 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); +unsigned long hwirq = d->hwirq; -tegra_msi_free (msi, d->hwirq); +irq_dispose_mapping (irq); +tegra_msi_free (msi, hwirq); }static struct irq_chip tegra_msi_irq_chip = {
Signature · 1 line
2.0.1
Quoted 3 lines · Jisheng Zhang
We should call
tegra_msi_free()to free the msi bit ifirq_create_mapping()fails. And we need to dispose the irq mapping during irq teardown.
"MSI" and "IRQ" please.
Quoted 17 lines
drivers/pci/host/pci-tegra.c +3
-1@@ -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);
drivers/pci/host/pci-tegra.c static void tegra_msi_teardown_irq(struct msi_chip *chip, unsigned int irq) · line 1227
Quoted 4 lines
drivers/pci/host/pci-tegra.c +1
-0@@ -1222,8 +1224,10 @@ 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); +unsigned long hwirq = d->hwirq;
I don't think we need this temporary variable, d->hwirq isn't overly long.
With both of the above address, this is:
Hi Thierry,
Quoted 6 lines · On Mon, 28 Jul 2014 08:35:50 -0700 Thierry Reding <[email protected]>…
Quoted 3 lines · Jisheng Zhang
We should call
tegra_msi_free()to free the msi bit ifirq_create_mapping()fails. And we need to dispose the irq mapping during irq teardown."MSI" and "IRQ" please.
Done in the v3 patch. Thanks for your reviewing.
Quoted 17 lines
Quoted 17 lines
drivers/pci/host/pci-tegra.c +3
-1@@ -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);
Quoted 8 lines
drivers/pci/host/pci-tegra.c static void tegra_msi_teardown_irq(struct msi_chip · line 1227
Quoted 5 lines
drivers/pci/host/pci-tegra.c +1
-0@@ -1222,8 +1224,10 @@ 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); +unsigned long hwirq = d->hwirq;I don't think we need this temporary variable,
d->hwirqisn't overly long.
irq_dispose_mapping() will clear d->hwirq as 0, so if we don't save to a temporary variable, we will always MSI 0, this is not what we want. What do you think?
Quoted 5 lines
With both of the above address, this is:
Reviewed-by Thierry Reding <[email protected]>Acked-by Thierry Reding <[email protected]>
Thanks for reviewing,
Jisheng