diff options
author | cg <cg@FreeBSD.org> | 2002-11-25 17:17:43 +0000 |
---|---|---|
committer | cg <cg@FreeBSD.org> | 2002-11-25 17:17:43 +0000 |
commit | c9457db52b78b8fe2844cb837ee11d32cb013d0b (patch) | |
tree | ac1448d81f09f0d496c1b9ce490a1df51856353d /sys/dev/sound/pcm/vchan.c | |
parent | 79ac90c6dbdb26a4402c5fb31a4a94d6e72e133e (diff) | |
download | FreeBSD-src-c9457db52b78b8fe2844cb837ee11d32cb013d0b.zip FreeBSD-src-c9457db52b78b8fe2844cb837ee11d32cb013d0b.tar.gz |
various fixes to eliminate locking warnings
Approved by: re
Reviewed by: orion
Diffstat (limited to 'sys/dev/sound/pcm/vchan.c')
-rw-r--r-- | sys/dev/sound/pcm/vchan.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index 3f754a7..8da3c3e 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -237,15 +237,8 @@ vchan_create(struct pcm_channel *parent) struct pcm_channel *child; int err, first; - CHN_LOCK(parent); - if (!(parent->flags & CHN_F_BUSY)) { - CHN_UNLOCK(parent); - return EBUSY; - } - pce = malloc(sizeof(*pce), M_DEVBUF, M_WAITOK | M_ZERO); if (!pce) { - CHN_UNLOCK(parent); return ENOMEM; } @@ -253,10 +246,15 @@ vchan_create(struct pcm_channel *parent) child = pcm_chn_create(d, parent, &vchan_class, PCMDIR_VIRTUAL, parent); if (!child) { free(pce, M_DEVBUF); - CHN_UNLOCK(parent); return ENODEV; } + CHN_LOCK(parent); + if (!(parent->flags & CHN_F_BUSY)) { + CHN_UNLOCK(parent); + return EBUSY; + } + first = SLIST_EMPTY(&parent->children); /* add us to our parent channel's children */ pce->channel = child; @@ -270,7 +268,7 @@ vchan_create(struct pcm_channel *parent) free(pce, M_DEVBUF); } - /* XXX gross ugly hack, kill murder death */ + /* XXX gross ugly hack, murder death kill */ if (first && !err) { err = chn_reset(parent, AFMT_STEREO | AFMT_S16_LE); if (err) |