diff options
| author | Cameron Grant <cg@FreeBSD.org> | 2002-01-23 04:44:03 +0000 |
|---|---|---|
| committer | Cameron Grant <cg@FreeBSD.org> | 2002-01-23 04:44:03 +0000 |
| commit | 095159ecd18c645d4dcd72d0924a9c43b982debf (patch) | |
| tree | 7da40118a6bd47bb278b48d53b117308706bdeb8 /sys/dev/sound | |
| parent | 1c72c53f4ecb3b031debb3166f56f4e7bf729731 (diff) | |
Notes
Diffstat (limited to 'sys/dev/sound')
| -rw-r--r-- | sys/dev/sound/pcm/dsp.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 55147e3f525d1..2f1462cfc5c98 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -285,7 +285,15 @@ dsp_open(dev_t i_dev, int flags, int mode, struct thread *td) /* bump refcounts, reset and unlock any channels that we just opened */ if (rdch) { if (flags & FREAD) { - chn_reset(rdch, fmt); + if (chn_reset(rdch, fmt)) { + pcm_lock(d); + pcm_chnrelease(rdch); + if (wrch && (flags & FWRITE)) + pcm_chnrelease(wrch); + pcm_unlock(d); + splx(s); + return ENODEV; + } if (flags & O_NONBLOCK) rdch->flags |= CHN_F_NBIO; } else @@ -296,7 +304,15 @@ dsp_open(dev_t i_dev, int flags, int mode, struct thread *td) } if (wrch) { if (flags & FWRITE) { - chn_reset(wrch, fmt); + if (chn_reset(wrch, fmt)) { + pcm_lock(d); + pcm_chnrelease(wrch); + if (rdch && (flags & FREAD)) + pcm_chnrelease(rdch); + pcm_unlock(d); + splx(s); + return ENODEV; + } if (flags & O_NONBLOCK) wrch->flags |= CHN_F_NBIO; } else |
