]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
vmw_vmci: handle the return value from pci_alloc_irq_vectors correctly
authorChristoph Hellwig <hch@lst.de>
Fri, 3 Mar 2017 14:58:06 +0000 (07:58 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Mar 2017 08:32:21 +0000 (17:32 +0900)
It returns the number of vectors allocated when successful, so check for
a negative error only.

Fixes: 3bb434cd ("vmw_vmci: switch to pci_irq_alloc_vectors")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Loïc Yhuel <loic.yhuel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/vmw_vmci/vmci_guest.c

index 9d659542a335b444914f2ead245f0975ac970a2b..dad5abee656ef550b0ac041e354e2c7ef89164e3 100644 (file)
@@ -566,10 +566,10 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
         */
        error = pci_alloc_irq_vectors(pdev, VMCI_MAX_INTRS, VMCI_MAX_INTRS,
                        PCI_IRQ_MSIX);
-       if (error) {
+       if (error < 0) {
                error = pci_alloc_irq_vectors(pdev, 1, 1,
                                PCI_IRQ_MSIX | PCI_IRQ_MSI | PCI_IRQ_LEGACY);
-               if (error)
+               if (error < 0)
                        goto err_remove_bitmap;
        } else {
                vmci_dev->exclusive_vectors = true;