diff options
| author | Linux Build Service Account <lnxbuild@quicinc.com> | 2017-05-11 11:48:38 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-05-11 11:48:37 -0700 |
| commit | c454ad4e3e59a22d1bdcbf8329e82dec54ad52ad (patch) | |
| tree | 18aa50cd0213a23f47086f13c668076613070cdb | |
| parent | a55a52a8a225c5601a0075fd640a6499e393eae8 (diff) | |
| parent | 82fe037ea706ad12d67e22db70bc02b65c5e6686 (diff) | |
Merge "sound: usb: Fix format desc usage for BADD 3.0 devices"
| -rw-r--r-- | sound/usb/stream.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sound/usb/stream.c b/sound/usb/stream.c index 2bb503576134..a7d7c3a0ac3e 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c @@ -652,6 +652,16 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no) case UAC_VERSION_3: { int wMaxPacketSize; + /* + * Allocate a dummy instance of fmt and set format type + * to UAC_FORMAT_TYPE_I for BADD support; free fmt + * after its last usage + */ + fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); + if (!fmt) + return -ENOMEM; + + fmt->bFormatType = UAC_FORMAT_TYPE_I; format = UAC_FORMAT_TYPE_I_PCM; clock = BADD_CLOCK_SOURCE; wMaxPacketSize = le16_to_cpu(get_endpoint(alts, 0) @@ -678,6 +688,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no) dev_err(&dev->dev, "%u:%d: invalid wMaxPacketSize\n", iface_no, altno); + kfree(fmt); continue; } } @@ -776,6 +787,8 @@ populate_fp: continue; } + if (protocol == UAC_VERSION_3) + kfree(fmt); /* Create chmap */ if (fp->channels != num_channels) chconfig = 0; |
