* [PATCH v2] PCI: tegra: add missing cleanup in error path and teardown_irq
@ 2014-07-28 3:45 Jisheng Zhang
[not found] ` <1406519142-3018-1-git-send-email-jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Jisheng Zhang @ 2014-07-28 3:45 UTC (permalink / raw)
To: thierry.reding, bhelgaas, swarren
Cc: linux-tegra, linux-pci, linux-kernel, Jisheng Zhang
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.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
drivers/pci/host/pci-tegra.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 083cf37..4ccc418 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -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 = {
--
2.0.1
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1406519142-3018-1-git-send-email-jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH v2] PCI: tegra: add missing cleanup in error path and teardown_irq [not found] ` <1406519142-3018-1-git-send-email-jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org> @ 2014-07-28 15:35 ` Thierry Reding 2014-07-29 1:42 ` Jisheng Zhang 0 siblings, 1 reply; 3+ messages in thread From: Thierry Reding @ 2014-07-28 15:35 UTC (permalink / raw) To: Jisheng Zhang Cc: bhelgaas-hpIqsD4AKlfQT0dZR+AlfA, swarren-3lzwWm7+Weoh9ZMKESR00Q, linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-pci-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 1270 bytes --] On Mon, Jul 28, 2014 at 11:45:42AM +0800, Jisheng Zhang wrote: > 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. "MSI" and "IRQ" please. > diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c > index 083cf37..4ccc418 100644 > --- a/drivers/pci/host/pci-tegra.c > +++ b/drivers/pci/host/pci-tegra.c > @@ -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; I don't think we need this temporary variable, d->hwirq isn't overly long. With both of the above address, this is: Reviewed-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> Acked-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> [-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] PCI: tegra: add missing cleanup in error path and teardown_irq 2014-07-28 15:35 ` Thierry Reding @ 2014-07-29 1:42 ` Jisheng Zhang 0 siblings, 0 replies; 3+ messages in thread From: Jisheng Zhang @ 2014-07-29 1:42 UTC (permalink / raw) To: Thierry Reding Cc: bhelgaas@google.com, swarren@wwwdotorg.org, linux-tegra@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Hi Thierry, On Mon, 28 Jul 2014 08:35:50 -0700 Thierry Reding <thierry.reding@gmail.com> wrote: > On Mon, Jul 28, 2014 at 11:45:42AM +0800, Jisheng Zhang wrote: > > 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. > > "MSI" and "IRQ" please. Done in the v3 patch. Thanks for your reviewing. > > > diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c > > index 083cf37..4ccc418 100644 > > --- a/drivers/pci/host/pci-tegra.c > > +++ b/drivers/pci/host/pci-tegra.c > > @@ -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; > > I don't think we need this temporary variable, d->hwirq isn'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? > > With both of the above address, this is: > > Reviewed-by: Thierry Reding <treding@nvidia.com> > Acked-by: Thierry Reding <treding@nvidia.com> Thanks for reviewing, Jisheng ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-29 1:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-28 3:45 [PATCH v2] PCI: tegra: add missing cleanup in error path and teardown_irq Jisheng Zhang
[not found] ` <1406519142-3018-1-git-send-email-jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2014-07-28 15:35 ` Thierry Reding
2014-07-29 1:42 ` Jisheng Zhang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox