diff options
author | cg <cg@FreeBSD.org> | 2002-11-25 17:03:39 +0000 |
---|---|---|
committer | cg <cg@FreeBSD.org> | 2002-11-25 17:03:39 +0000 |
commit | f65ee32d14271ec8572e920508e632672d8dadbb (patch) | |
tree | 963b97801f6fd64beaf22a604f71e4330a7460d3 /sys | |
parent | 3072b450a986c3a301a10407ee0038625295a2dc (diff) | |
download | FreeBSD-src-f65ee32d14271ec8572e920508e632672d8dadbb.zip FreeBSD-src-f65ee32d14271ec8572e920508e632672d8dadbb.tar.gz |
if the list of supported formats is empty, fail the attach instead of
panicing later. this is a band-aid pending further investigation.
MFC After: 7 days
Approved by: re
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/sound/usb/uaudio_pcm.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/dev/sound/usb/uaudio_pcm.c b/sys/dev/sound/usb/uaudio_pcm.c index a49ee4a..4ea33f3 100644 --- a/sys/dev/sound/usb/uaudio_pcm.c +++ b/sys/dev/sound/usb/uaudio_pcm.c @@ -74,19 +74,23 @@ ua_chan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel * ch->channel = c; ch->buffer = b; + pa_dev = device_get_parent(sc->sc_dev); + /* Create ua_playfmt[] & ua_recfmt[] */ + uaudio_query_formats(pa_dev, (u_int32_t *)&ua_playfmt, (u_int32_t *)&ua_recfmt); + if (ua_playfmt[0] == 0) { + printf("%s channel supported format list invalid\n", dir == PCMDIR_PLAY? "play" : "record"); + return NULL; + } + /* allocate PCM side DMA buffer */ if (sndbuf_alloc(ch->buffer, sc->parent_dmat, UAUDIO_PCM_BUFF_SIZE) != 0) { return NULL; } - pa_dev = device_get_parent(sc->sc_dev); buf = end = sndbuf_getbuf(b); end += sndbuf_getsize(b); uaudio_chan_set_param_pcm_dma_buff(pa_dev, buf, end, ch->channel); - /* Create ua_playfmt[] & ua_recfmt[] */ - uaudio_query_formats(pa_dev, (u_int32_t *)&ua_playfmt, (u_int32_t *)&ua_recfmt); - ch->dir = dir; #ifndef NO_RECORDING ch->hwch = 1; |