Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci - Fix panic in xhci_pci_detach() if xhci_pci_att...



details:   https://anonhg.NetBSD.org/src/rev/c38e04cbebe5
branches:  trunk
changeset: 358402:c38e04cbebe5
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Dec 28 05:43:42 2017 +0000

description:
- Fix panic in xhci_pci_detach() if xhci_pci_attach() failed.
- Fallback from MSI to INTx correctly.

diffstat:

 sys/dev/pci/xhci_pci.c |  17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diffs (48 lines):

diff -r 2228f9cec66a -r c38e04cbebe5 sys/dev/pci/xhci_pci.c
--- a/sys/dev/pci/xhci_pci.c    Thu Dec 28 04:38:02 2017 +0000
+++ b/sys/dev/pci/xhci_pci.c    Thu Dec 28 05:43:42 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci_pci.c,v 1.10 2017/12/25 08:39:38 msaitoh Exp $    */
+/*     $NetBSD: xhci_pci.c,v 1.11 2017/12/28 05:43:42 msaitoh Exp $    */
 /*     OpenBSD: xhci_pci.c,v 1.4 2014/07/12 17:38:51 yuo Exp   */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.10 2017/12/25 08:39:38 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.11 2017/12/28 05:43:42 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_xhci_pci.h"
@@ -204,6 +204,7 @@
                case PCI_INTR_TYPE_MSI:
                        /* The next try is for INTx: Disable MSI */
                        counts[PCI_INTR_TYPE_MSI] = 0;
+                       counts[PCI_INTR_TYPE_INTX] = 1;
                        goto alloc_retry;
                case PCI_INTR_TYPE_INTX:
                default:
@@ -273,15 +274,15 @@
        struct xhci_softc * const sc = &psc->sc_xhci;
        int rv;
 
-       rv = xhci_detach(sc, flags);
-       if (rv)
-               return rv;
+       if (sc->sc_ios != 0) {
+               rv = xhci_detach(sc, flags);
+               if (rv)
+                       return rv;
 
-       pmf_device_deregister(self);
+               pmf_device_deregister(self);
 
-       xhci_shutdown(self, flags);
+               xhci_shutdown(self, flags);
 
-       if (sc->sc_ios) {
 #if 0
                /* Disable interrupts, so we don't get any spurious ones. */
                bus_space_write_4(sc->sc_iot, sc->sc_ioh,



Home | Main Index | Thread Index | Old Index