Module Name:    src
Committed By:   msaitoh
Date:           Tue Jan 30 08:53:39 UTC 2018

Modified Files:
        src/sys/dev/usb: xhci.c

Log Message:
 Avoid panic while detaching xhci. The xhci driver has both sc_child and
sc_child2 but xhci_childdet() only supported sc_child. OK'd by Nick.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/usb/xhci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.83 src/sys/dev/usb/xhci.c:1.84
--- src/sys/dev/usb/xhci.c:1.83	Wed Dec 20 08:21:11 2017
+++ src/sys/dev/usb/xhci.c	Tue Jan 30 08:53:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.83 2017/12/20 08:21:11 skrll Exp $	*/
+/*	$NetBSD: xhci.c,v 1.84 2018/01/30 08:53:39 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.83 2017/12/20 08:21:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.84 2018/01/30 08:53:39 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -577,8 +577,10 @@ xhci_childdet(device_t self, device_t ch
 {
 	struct xhci_softc * const sc = device_private(self);
 
-	KASSERT(sc->sc_child == child);
-	if (child == sc->sc_child)
+	KASSERT((sc->sc_child == child) || (sc->sc_child2 == child));
+	if (child == sc->sc_child2)
+		sc->sc_child2 = NULL;
+	else if (child == sc->sc_child)
 		sc->sc_child = NULL;
 }
 

Reply via email to