Use the correct mutex in umidi_open()

Submitted by:	Hans Petter Selasky
Approved by:	re (kib)
This commit is contained in:
Andrew Thompson 2009-06-27 21:21:11 +00:00
parent 3c3e9d336d
commit 7e6e6b6766

View File

@ -3671,24 +3671,24 @@ umidi_open(struct usb_fifo *fifo, int fflags)
if (usb_fifo_alloc_buffer(fifo, 4, (1024 / 4))) {
return (ENOMEM);
}
mtx_lock(&Giant);
mtx_lock(&chan->mtx);
chan->read_open_refcount++;
sub->read_open = 1;
mtx_unlock(&Giant);
mtx_unlock(&chan->mtx);
}
if (fflags & FWRITE) {
if (usb_fifo_alloc_buffer(fifo, 32, (1024 / 32))) {
return (ENOMEM);
}
/* clear stall first */
mtx_lock(&Giant);
mtx_lock(&chan->mtx);
chan->flags |= UMIDI_FLAG_WRITE_STALL;
chan->write_open_refcount++;
sub->write_open = 1;
/* reset */
sub->state = UMIDI_ST_UNKNOWN;
mtx_unlock(&Giant);
mtx_unlock(&chan->mtx);
}
return (0); /* success */
}