diff mbox

[4/8] pci/msi: Relocate error path in init_msix_capability()

Message ID 4A7A4103.7080202@jp.fujitsu.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Hidetoshi Seto Aug. 6, 2009, 2:33 a.m. UTC
Move it from the middle of the function to the end.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
---
 drivers/pci/msi.c |   40 ++++++++++++++++++++++------------------
 1 files changed, 22 insertions(+), 18 deletions(-)

Comments

Matthew Wilcox Aug. 7, 2009, 5:22 p.m. UTC | #1
On Thu, Aug 06, 2009 at 11:33:39AM +0900, Hidetoshi Seto wrote:
> Move it from the middle of the function to the end.
> 
> Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>

Reviewed-by: Matthew Wilcox <willy@linux.intel.com>
diff mbox

Patch

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index a7f2a01..7085d66 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -494,24 +494,8 @@  static int msix_capability_init(struct pci_dev *dev,
 	}
 
 	ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSIX);
-	if (ret < 0) {
-		/* If we had some success report the number of irqs
-		 * we succeeded in setting up. */
-		int avail = 0;
-		list_for_each_entry(entry, &dev->msi_list, list) {
-			if (entry->irq != 0) {
-				avail++;
-			}
-		}
-
-		if (avail != 0)
-			ret = avail;
-	}
-
-	if (ret) {
-		free_msi_irqs(dev);
-		return ret;
-	}
+	if (ret)
+		goto error;
 
 	/*
 	 * Some devices require MSI-X to be enabled before we can touch the
@@ -540,6 +524,26 @@  static int msix_capability_init(struct pci_dev *dev,
 	pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control);
 
 	return 0;
+
+error:
+	if (ret < 0) {
+		/*
+		 * If we had some success, report the number of irqs
+		 * we succeeded in setting up.
+		 */
+		int avail = 0;
+
+		list_for_each_entry(entry, &dev->msi_list, list) {
+			if (entry->irq != 0)
+				avail++;
+		}
+		if (avail != 0)
+			ret = avail;
+	}
+
+	free_msi_irqs(dev);
+
+	return ret;
 }
 
 /**