diff options
-rw-r--r-- | sys/dev/sound/pcm/channel.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pcm/sound.c | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 3f48edd..a8d0466 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1021,7 +1021,8 @@ chn_init(pcm_channel *c, void *devinfo, int dir) c->feeder = &feeder_root; c->buffer.chan = -1; c->devinfo = c->init(devinfo, &c->buffer, c, dir); - if (c->devinfo == NULL) panic("c->init() failed"); + if (c->devinfo == NULL) + return 1; chn_setdir(c, dir); /* And the secondary buffer. */ diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index db31071..84ba6af 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -101,9 +101,15 @@ pcm_addchan(device_t dev, int dir, pcm_channel *templ, void *devinfo) snddev_info *d = device_get_softc(dev); pcm_channel *ch; - ch = (dir == PCMDIR_PLAY)? &d->play[d->playcount++] : &d->rec[d->reccount++]; + ch = (dir == PCMDIR_PLAY)? &d->play[d->playcount] : &d->rec[d->reccount]; *ch = *templ; - chn_init(ch, devinfo, dir); + if (chn_init(ch, devinfo, dir)) { + device_printf(dev, "chn_init() for %s:%d failed\n", + (dir == PCMDIR_PLAY)? "play" : "record", + (dir == PCMDIR_PLAY)? d->playcount : d->reccount); + return 1; + } + if (dir == PCMDIR_PLAY) d->playcount++; else d->reccount++; make_dev(&snd_cdevsw, PCMMKMINOR(unit, SND_DEV_DSP, d->chancount), UID_ROOT, GID_WHEEL, 0666, "dsp%d.%d", unit, d->chancount); make_dev(&snd_cdevsw, PCMMKMINOR(unit, SND_DEV_AUDIO, d->chancount), |