[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <162858645993.395.16701531835157713256.tip-bot2@tip-bot2>
Date: Tue, 10 Aug 2021 09:07:39 -0000
From: "tip-bot2 for Thomas Gleixner" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
Marc Zyngier <maz@...nel.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: irq/core] PCI/MSI: Consolidate error handling in msi_capability_init()
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 8eb5ce3f78a5e5d3f1a12248f6b7dc64ebf71da6
Gitweb: https://git.kernel.org/tip/8eb5ce3f78a5e5d3f1a12248f6b7dc64ebf71da6
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Thu, 29 Jul 2021 23:51:54 +02:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Tue, 10 Aug 2021 11:03:29 +02:00
PCI/MSI: Consolidate error handling in msi_capability_init()
Three error exits doing exactly the same ask for a common error exit point.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Tested-by: Marc Zyngier <maz@...nel.org>
Reviewed-by: Marc Zyngier <maz@...nel.org>
Link: https://lore.kernel.org/r/20210729222543.098828720@linutronix.de
---
drivers/pci/msi.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 175f4d6..d2821bb 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -659,25 +659,16 @@ static int msi_capability_init(struct pci_dev *dev, int nvec,
/* Configure MSI capability structure */
ret = pci_msi_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSI);
- if (ret) {
- msi_mask_irq(entry, mask, 0);
- free_msi_irqs(dev);
- return ret;
- }
+ if (ret)
+ goto err;
ret = msi_verify_entries(dev);
- if (ret) {
- msi_mask_irq(entry, mask, 0);
- free_msi_irqs(dev);
- return ret;
- }
+ if (ret)
+ goto err;
ret = populate_msi_sysfs(dev);
- if (ret) {
- msi_mask_irq(entry, mask, 0);
- free_msi_irqs(dev);
- return ret;
- }
+ if (ret)
+ goto err;
/* Set MSI enabled bits */
pci_intx_for_msi(dev, 0);
@@ -687,6 +678,11 @@ static int msi_capability_init(struct pci_dev *dev, int nvec,
pcibios_free_irq(dev);
dev->irq = entry->irq;
return 0;
+
+err:
+ msi_mask_irq(entry, mask, 0);
+ free_msi_irqs(dev);
+ return ret;
}
static void __iomem *msix_map_region(struct pci_dev *dev, unsigned nr_entries)
Powered by blists - more mailing lists