aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorCameron Grant <cg@FreeBSD.org>2000-06-06 22:24:53 +0000
committerCameron Grant <cg@FreeBSD.org>2000-06-06 22:24:53 +0000
commit9c3268206d254d010a1562a494912f2101b04d25 (patch)
treecf669c25e9b17473e2ef8418d72dbf175ff7e627 /sys/dev
parent2ac1994e85d8db0b5556cb1f075b7c2666739178 (diff)
Notes
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/sound/pcm/sound.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c
index 881f3311f26d1..0d3a84caa670f 100644
--- a/sys/dev/sound/pcm/sound.c
+++ b/sys/dev/sound/pcm/sound.c
@@ -99,6 +99,11 @@ pcm_addchan(device_t dev, int dir, pcm_channel *templ, void *devinfo)
snddev_info *d = device_get_softc(dev);
pcm_channel *ch;
+ if (((dir == PCMDIR_PLAY)? d->play : d->rec) == NULL) {
+ device_printf(dev, "bad channel add (%s)\n",
+ (dir == PCMDIR_PLAY)? "play" : "record");
+ return 1;
+ }
ch = (dir == PCMDIR_PLAY)? &d->play[d->playcount] : &d->rec[d->reccount];
*ch = *templ;
if (chn_init(ch, devinfo, dir)) {
@@ -193,14 +198,16 @@ pcm_register(device_t dev, void *devinfo, int numplay, int numrec)
M_DEVBUF, M_NOWAIT);
if (!d->play) goto no;
bzero(d->play, numplay * sizeof(pcm_channel));
- }
+ } else
+ d->play = NULL;
if (numrec > 0) {
d->rec = (pcm_channel *)malloc(numrec * sizeof(pcm_channel),
M_DEVBUF, M_NOWAIT);
if (!d->rec) goto no;
bzero(d->rec, numrec * sizeof(pcm_channel));
- }
+ } else
+ d->rec = NULL;
if (numplay == 0 || numrec == 0)
d->flags |= SD_F_SIMPLEX;