diff options
-rw-r--r-- | drivers/pci/msi.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 33adf323f064..dceea56f7342 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -42,8 +42,10 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | |||
42 | 42 | ||
43 | list_for_each_entry(entry, &dev->msi_list, list) { | 43 | list_for_each_entry(entry, &dev->msi_list, list) { |
44 | ret = arch_setup_msi_irq(dev, entry); | 44 | ret = arch_setup_msi_irq(dev, entry); |
45 | if (ret) | 45 | if (ret < 0) |
46 | return ret; | 46 | return ret; |
47 | if (ret > 0) | ||
48 | return -ENOSPC; | ||
47 | } | 49 | } |
48 | 50 | ||
49 | return 0; | 51 | return 0; |
@@ -487,7 +489,9 @@ static int msix_capability_init(struct pci_dev *dev, | |||
487 | } | 489 | } |
488 | 490 | ||
489 | ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSIX); | 491 | ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSIX); |
490 | if (ret) { | 492 | if (ret < 0) { |
493 | /* If we had some success report the number of irqs | ||
494 | * we succeeded in setting up. */ | ||
491 | int avail = 0; | 495 | int avail = 0; |
492 | list_for_each_entry(entry, &dev->msi_list, list) { | 496 | list_for_each_entry(entry, &dev->msi_list, list) { |
493 | if (entry->irq != 0) { | 497 | if (entry->irq != 0) { |
@@ -495,14 +499,13 @@ static int msix_capability_init(struct pci_dev *dev, | |||
495 | } | 499 | } |
496 | } | 500 | } |
497 | 501 | ||
498 | msi_free_irqs(dev); | 502 | if (avail != 0) |
503 | ret = avail; | ||
504 | } | ||
499 | 505 | ||
500 | /* If we had some success report the number of irqs | 506 | if (ret) { |
501 | * we succeeded in setting up. | 507 | msi_free_irqs(dev); |
502 | */ | 508 | return ret; |
503 | if (avail == 0) | ||
504 | avail = ret; | ||
505 | return avail; | ||
506 | } | 509 | } |
507 | 510 | ||
508 | i = 0; | 511 | i = 0; |