Skip to contentSkip to conversation

vmw_vmci: handle the return value from pci_alloc_irq_vectors correctly

PATCH New Christoph Hellwig 1 participant 1 message Mar 3, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vmw_vmci: handle the return value from pci_alloc_irq_vectors correctly

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")
---
 drivers/misc/vmw_vmci/vmci_guest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/vmw_vmci/vmci_guest.c +2 -2
index 9d659542a335..dad5abee656e 100644
@@ -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;
Signature · 1 line
2.11.0