Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Do not mutex_enter() a usb_taskq[-1].



details:   https://anonhg.NetBSD.org/src/rev/1b761de4e445
branches:  trunk
changeset: 780237:1b761de4e445
user:      cegger <cegger%NetBSD.org@localhost>
date:      Tue Jul 17 10:18:43 2012 +0000

description:
Do not mutex_enter() a usb_taskq[-1].
Fixes LOCKDEBUG panic.

diffstat:

 sys/dev/usb/usb.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (36 lines):

diff -r 1048b256eb50 -r 1b761de4e445 sys/dev/usb/usb.c
--- a/sys/dev/usb/usb.c Tue Jul 17 08:05:17 2012 +0000
+++ b/sys/dev/usb/usb.c Tue Jul 17 10:18:43 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb.c,v 1.130 2012/06/10 06:15:54 mrg Exp $    */
+/*     $NetBSD: usb.c,v 1.131 2012/07/17 10:18:43 cegger Exp $ */
 
 /*
  * Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.130 2012/06/10 06:15:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.131 2012/07/17 10:18:43 cegger Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usb.h"
@@ -364,12 +364,13 @@
 {
        struct usb_taskq *taskq;
 
+       if (task->queue == -1)
+               return;
+
        taskq = &usb_taskq[task->queue];
        mutex_enter(&taskq->lock);
-       if (task->queue != -1) {
-               TAILQ_REMOVE(&taskq->tasks, task, next);
-               task->queue = -1;
-       }
+       TAILQ_REMOVE(&taskq->tasks, task, next);
+       task->queue = -1;
        mutex_exit(&taskq->lock);
 }
 



Home | Main Index | Thread Index | Old Index