Skip to contentSkip to conversation

igb: fix misinterpreted return value of pci_enable_msix

PATCH In review Stefan Assmann 2 participants 3 messages Nov 24, 2009

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

PATCH 1/1 igb: fix misinterpreted return value of pci_enable_msix

From: Stefan Assmann <[email protected]>

In the igb driver a return value of 0 of function pci_enable_msix is interpreted as an error case. The correct behaviour is to check < 0 for error values.

---
 drivers/net/igb/igb_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/igb/igb_main.c +1 -1
index bb1a6ee..745481d 100644
@@ -694,7 +694,7 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter)
 	err = pci_enable_msix(adapter->pdev,
 			      adapter->msix_entries,
 			      numvecs);
-	if (err == 0)
+	if (err < 0)
 		goto out;
 
 	igb_reset_interrupt_capability(adapter);
Signature · 1 line
1.6.5.2
#1 lore raw
Quoted 16 lines · Stefan Assmann

From: Stefan Assmann <[email protected]>

In the igb driver a return value of 0 of function pci_enable_msix is interpreted as an error case. The correct behaviour is to check < 0 for error values.

---
 drivers/net/igb/igb_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/igb/igb_main.c +0 -0
index bb1a6ee..745481d 100644

drivers/net/igb/igb_main.c static void igb_set_interrupt_capability(struct igb_adapter *adapter) · line 699

Quoted 7 lines
drivers/net/igb/igb_main.c +1 -1
@@ -694,7 +694,7 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter)
 	err = pci_enable_msix(adapter->pdev,
 			      adapter->msix_entries,
 			      numvecs);
-	if (err == 0)
+	if (err < 0)
 		goto out;
 

The existing code looks correct to me:

      if (err == 0)
            goto out;

      igb_reset_interrupt_capability(adapter);

      /* If we can't do MSI-X, try MSI * */

msi_only:

so the "goto out" appears to be the "success" case.

#2 lore raw
Quoted 33 lines · Florian Westphal
Quoted 16 lines · Stefan Assmann

From: Stefan Assmann <[email protected]>

In the igb driver a return value of 0 of function pci_enable_msix is interpreted as an error case. The correct behaviour is to check < 0 for error values.

---
 drivers/net/igb/igb_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/igb/igb_main.c +0 -0
index bb1a6ee..745481d 100644

drivers/net/igb/igb_main.c static void igb_set_interrupt_capability(struct igb_adapter *adapter) · line 699

Quoted 7 lines
drivers/net/igb/igb_main.c +1 -1
@@ -694,7 +694,7 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter)
 	err = pci_enable_msix(adapter->pdev,
 			      adapter->msix_entries,
 			      numvecs);
-	if (err == 0)
+	if (err < 0)
 		goto out;
 

The existing code looks correct to me:

      if (err == 0)
            goto out;

      igb_reset_interrupt_capability(adapter);

      /* If we can't do MSI-X, try MSI * */
Quoted 4 lines

msi_only:

so the "goto out" appears to be the "success" case.

Hi Florian,

thanks for pointing this out. I've jumped to conclusions too fast. There's a problem with igb MSI-X in RHEL5 in the kdump case and this fixed it for me. But you're right, it's not the proper solution. I'll report back when I have more information.

Stefan

--

Stefan Assmann         | Red Hat GmbH
Software Engineer      | Otto-Hahn-Strasse 20, 85609 Dornach
                       | HR: Amtsgericht Muenchen HRB 153243
                       | GF: Brendan Lane, Charlie Peters,
sassmann at redhat.com |     Michael Cunningham, Charles Cachera