aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@suse.cz>2004-04-24 19:46:51 +0200
committerJaroslav Kysela <perex@suse.cz>2004-04-24 19:46:51 +0200
commit3590c3c1bb9e81fc252aed8008c7cb1af9f1ff0b (patch)
treec0fa60024e035ddd1a2c68310b59316123cbae6a /sound
parent308ff2ae21ab6bcb531c6be4329971031a516bc7 (diff)
downloadhistory-3590c3c1bb9e81fc252aed8008c7cb1af9f1ff0b.tar.gz
ALSA CVS update - Clemens Ladisch <clemens@ladisch.de>
USB generic driver allow specification of rate_table in AUDIO_FIXED_ENDPOINT quirks
Diffstat (limited to 'sound')
-rw-r--r--sound/usb/usbaudio.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index 1a7ab1bd07826c..c7b26aa8b96dfe 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -2640,6 +2640,7 @@ static int create_fixed_stream_quirk(snd_usb_audio_t *chip,
struct audioformat *fp;
struct usb_host_interface *alts;
int stream, err;
+ int *rate_table = NULL;
fp = kmalloc(sizeof(*fp), GFP_KERNEL);
if (! fp) {
@@ -2647,16 +2648,30 @@ static int create_fixed_stream_quirk(snd_usb_audio_t *chip,
return -ENOMEM;
}
memcpy(fp, quirk->data, sizeof(*fp));
+ if (fp->nr_rates > 0) {
+ rate_table = kmalloc(sizeof(int) * fp->nr_rates, GFP_KERNEL);
+ if (!rate_table) {
+ kfree(fp);
+ return -ENOMEM;
+ }
+ memcpy(rate_table, fp->rate_table, sizeof(int) * fp->nr_rates);
+ fp->rate_table = rate_table;
+ }
+
stream = (fp->endpoint & USB_DIR_IN)
? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
err = add_audio_endpoint(chip, stream, fp);
if (err < 0) {
kfree(fp);
+ if (rate_table)
+ kfree(rate_table);
return err;
}
if (fp->iface != get_iface_desc(&iface->altsetting[0])->bInterfaceNumber ||
fp->altset_idx >= iface->num_altsetting) {
kfree(fp);
+ if (rate_table)
+ kfree(rate_table);
return -EINVAL;
}
alts = &iface->altsetting[fp->altset_idx];