diff options
author | Cameron Grant <cg@FreeBSD.org> | 2002-11-25 17:03:39 +0000 |
---|---|---|
committer | Cameron Grant <cg@FreeBSD.org> | 2002-11-25 17:03:39 +0000 |
commit | 0586ff0d8499be18d1f273e33eb4472a96217ecd (patch) | |
tree | 963b97801f6fd64beaf22a604f71e4330a7460d3 /sys/dev | |
parent | 35cf61f671a5376fc4e9811cd13626722005da78 (diff) | |
download | src-0586ff0d8499be18d1f273e33eb4472a96217ecd.tar.gz src-0586ff0d8499be18d1f273e33eb4472a96217ecd.zip |
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
Notes
Notes:
svn path=/head/; revision=107235
Diffstat (limited to 'sys/dev')
-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 a49ee4ab872b..4ea33f3b707b 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; |