Module Name:    src
Committed By:   christos
Date:           Tue Jan 29 19:27:37 UTC 2013

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

Log Message:
correct previous. assign the sc, and move the destroy later where it is safe


To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 src/sys/dev/usb/uhci.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/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.253 src/sys/dev/usb/uhci.c:1.254
--- src/sys/dev/usb/uhci.c:1.253	Mon Jan 28 19:00:15 2013
+++ src/sys/dev/usb/uhci.c	Tue Jan 29 14:27:36 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.253 2013/01/29 00:00:15 christos Exp $	*/
+/*	$NetBSD: uhci.c,v 1.254 2013/01/29 19:27:36 christos Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.253 2013/01/29 00:00:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.254 2013/01/29 19:27:36 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -578,8 +578,6 @@ uhci_detach(struct uhci_softc *sc, int f
 	if (rv != 0)
 		return (rv);
 
-	pool_cache_destroy(sc->sc_xferpool);
-
 	callout_halt(&sc->sc_poll_handle, NULL);
 	callout_destroy(&sc->sc_poll_handle);
 
@@ -588,6 +586,8 @@ uhci_detach(struct uhci_softc *sc, int f
 	mutex_destroy(&sc->sc_lock);
 	mutex_destroy(&sc->sc_intr_lock);
 
+	pool_cache_destroy(sc->sc_xferpool);
+
 	/* XXX free other data structures XXX */
 
 	return (rv);
@@ -650,6 +650,7 @@ uhci_allocx(struct usbd_bus *bus)
 	xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT);
 	if (xfer != NULL) {
 		memset(xfer, 0, sizeof(struct uhci_xfer));
+		UXFER(xfer)->iinfo.sc = sc;
 #ifdef DIAGNOSTIC
 		UXFER(xfer)->iinfo.isdone = 1;
 		xfer->busy_free = XFER_BUSY;

Reply via email to