aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>2009-08-06 11:33:39 +0900
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-09-09 13:29:32 -0700
commit583871d436bea48cc2204cee0ec8eb7025e03db6 (patch)
tree607f50839335e102e103c579115738babce4a0db /drivers/pci
parentf56e4481328071d293306a55a951d83639d8d529 (diff)
PCI MSI: Relocate error path in init_msix_capability()
Move it from the middle of the function to the end. Reviewed-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/msi.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index a7f2a014046..7085d665db0 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;
}
/**