Module Name:    src
Committed By:   aymeric
Date:           Thu Aug 15 15:26:50 UTC 2013

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

Log Message:
In the error paths where uaudio_chan_free_buffers() has to be called, acquire
the uaudio spinlock after the call because another spinlock is used indirectly
during the call.
Fixes a panic with LOCKDEBUG when a low-speed uaudio attached to a high-speed
hub is opened.


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/sys/dev/usb/uaudio.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/uaudio.c
diff -u src/sys/dev/usb/uaudio.c:1.136 src/sys/dev/usb/uaudio.c:1.137
--- src/sys/dev/usb/uaudio.c:1.136	Sun May 12 09:54:55 2013
+++ src/sys/dev/usb/uaudio.c	Thu Aug 15 15:26:50 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: uaudio.c,v 1.136 2013/05/12 09:54:55 wiz Exp $	*/
+/*	$NetBSD: uaudio.c,v 1.137 2013/08/15 15:26:50 aymeric Exp $	*/
 
 /*
  * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.136 2013/05/12 09:54:55 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.137 2013/08/15 15:26:50 aymeric Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2593,9 +2593,9 @@ uaudio_trigger_input(void *addr, void *s
 	}
 
 	err = uaudio_chan_open(sc, ch);
-	mutex_spin_enter(&sc->sc_intr_lock);
 	if (err) {
 		uaudio_chan_free_buffers(sc, ch);
+		mutex_spin_enter(&sc->sc_intr_lock);
 		return EIO;
 	}
 
@@ -2640,9 +2640,9 @@ uaudio_trigger_output(void *addr, void *
 	}
 
 	err = uaudio_chan_open(sc, ch);
-	mutex_spin_enter(&sc->sc_intr_lock);
 	if (err) {
 		uaudio_chan_free_buffers(sc, ch);
+		mutex_spin_enter(&sc->sc_intr_lock);
 		return EIO;
 	}
 

Reply via email to