aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb/usb_dev.c
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2014-01-17 08:21:09 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2014-01-17 08:21:09 +0000
commitc7d8c1c6e0a25cd5ee6b6a4e4e28a1c7c12d3ce6 (patch)
treebddc3036ec65e4298272df51ecd85b3d4942ada0 /sys/dev/usb/usb_dev.c
parent0cfea1c8fc539d70dc0d8333cf6e42db06cc752a (diff)
Notes
Diffstat (limited to 'sys/dev/usb/usb_dev.c')
-rw-r--r--sys/dev/usb/usb_dev.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c
index 9e3cef5220a74..c5ee368fc9bae 100644
--- a/sys/dev/usb/usb_dev.c
+++ b/sys/dev/usb/usb_dev.c
@@ -597,6 +597,13 @@ usb_fifo_free(struct usb_fifo *f)
mtx_unlock(f->priv_mtx);
mtx_lock(&usb_ref_lock);
+ /*
+ * Check if the "f->refcount" variable reached zero
+ * during the unlocked time before entering wait:
+ */
+ if (f->refcount == 0)
+ break;
+
/* wait for sync */
cv_wait(&f->cv_drain, &usb_ref_lock);
}