Author: scottl
Date: Mon Jul 31 16:55:56 2017
New Revision: 321799
URL: https://svnweb.freebsd.org/changeset/base/321799

Log:
  Fix a logic bug in the split PCI interrupt code that slipped through
  
  Reported by:  Harry Schmalzbauer

Modified:
  head/sys/dev/mpr/mpr_pci.c
  head/sys/dev/mps/mps_pci.c

Modified: head/sys/dev/mpr/mpr_pci.c
==============================================================================
--- head/sys/dev/mpr/mpr_pci.c  Mon Jul 31 16:46:16 2017        (r321798)
+++ head/sys/dev/mpr/mpr_pci.c  Mon Jul 31 16:55:56 2017        (r321799)
@@ -260,6 +260,7 @@ mpr_pci_alloc_interrupts(struct mpr_softc *sc)
 
        dev = sc->mpr_dev;
        error = 0;
+       msgs = 0;
 
        if ((sc->disable_msix == 0) &&
            ((msgs = pci_msix_count(dev)) >= MPR_MSI_COUNT))
@@ -267,7 +268,7 @@ mpr_pci_alloc_interrupts(struct mpr_softc *sc)
        if ((error != 0) && (sc->disable_msi == 0) &&
            ((msgs = pci_msi_count(dev)) >= MPR_MSI_COUNT))
                error = mpr_alloc_msi(sc, MPR_MSI_COUNT);
-       else
+       if (error != 0)
                msgs = 0;
 
        sc->msi_msgs = msgs;

Modified: head/sys/dev/mps/mps_pci.c
==============================================================================
--- head/sys/dev/mps/mps_pci.c  Mon Jul 31 16:46:16 2017        (r321798)
+++ head/sys/dev/mps/mps_pci.c  Mon Jul 31 16:55:56 2017        (r321799)
@@ -245,6 +245,7 @@ mps_pci_alloc_interrupts(struct mps_softc *sc)
 
        dev = sc->mps_dev;
        error = 0;
+       msgs = 0;
 
        if ((sc->disable_msix == 0) &&
            ((msgs = pci_msix_count(dev)) >= MPS_MSI_COUNT))
@@ -252,7 +253,7 @@ mps_pci_alloc_interrupts(struct mps_softc *sc)
        if ((error != 0) && (sc->disable_msi == 0) &&
            ((msgs = pci_msi_count(dev)) >= MPS_MSI_COUNT))
                error = mps_alloc_msi(sc, MPS_MSI_COUNT);
-       else
+       if (error != 0)
                msgs = 0;
 
        sc->msi_msgs = msgs;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to