ahci: Fix broken fallback to single MSI mode
authorAlexander Gordeev <agordeev@redhat.com>
Fri, 14 Feb 2014 21:27:19 +0000 (14:27 -0700)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 14 Feb 2014 21:27:19 +0000 (14:27 -0700)
Commit 7b92b4f61ec4 ("PCI/MSI: Remove pci_enable_msi_block_auto()")
introduced a regression: if multiple MSI initialization fails, the code
falls back to INTx rather than to single MSI.

Fixes: 7b92b4f61ec4 ("PCI/MSI: Remove pci_enable_msi_block_auto()")
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Tejun Heo <tj@kernel.org>
drivers/ata/ahci.c

index dc2756f..3c5f35e 100644 (file)
@@ -1170,8 +1170,10 @@ static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports,
 
        nvec = rc;
        rc = pci_enable_msi_block(pdev, nvec);
-       if (rc)
+       if (rc < 0)
                goto intx;
+       else if (rc > 0)
+               goto single_msi;
 
        return nvec;