summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound
diff options
context:
space:
mode:
authorcg <cg@FreeBSD.org>2002-11-25 17:03:39 +0000
committercg <cg@FreeBSD.org>2002-11-25 17:03:39 +0000
commitf65ee32d14271ec8572e920508e632672d8dadbb (patch)
tree963b97801f6fd64beaf22a604f71e4330a7460d3 /sys/dev/sound
parent3072b450a986c3a301a10407ee0038625295a2dc (diff)
downloadFreeBSD-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/dev/sound')
-rw-r--r--sys/dev/sound/usb/uaudio_pcm.c12
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;
OpenPOWER on IntegriCloud