Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 131533
b: refs/heads/master
c: 0412558
h: refs/heads/master
i:
  131531: 0f1f11d
v: v3
  • Loading branch information
Takashi Iwai committed Feb 16, 2009
1 parent de42122 commit dc07c37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e156ac4c571e3be741bc411e58820b74a9295c72
refs/heads/master: 0412558c873f716efe902b397af0653a550f7341
17 changes: 9 additions & 8 deletions trunk/sound/usb/usbaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2524,32 +2524,33 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform
* build the rate table and bitmap flags
*/
int r, idx;
unsigned int nonzero_rates = 0;

fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL);
if (fp->rate_table == NULL) {
snd_printk(KERN_ERR "cannot malloc\n");
return -1;
}

fp->nr_rates = nr_rates;
fp->rate_min = fp->rate_max = combine_triple(&fmt[8]);
fp->nr_rates = 0;
fp->rate_min = fp->rate_max = 0;
for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) {
unsigned int rate = combine_triple(&fmt[idx]);
if (!rate)
continue;
/* C-Media CM6501 mislabels its 96 kHz altsetting */
if (rate == 48000 && nr_rates == 1 &&
chip->usb_id == USB_ID(0x0d8c, 0x0201) &&
fp->altsetting == 5 && fp->maxpacksize == 392)
rate = 96000;
fp->rate_table[r] = rate;
nonzero_rates |= rate;
if (rate < fp->rate_min)
fp->rate_table[fp->nr_rates] = rate;
if (!fp->rate_min || rate < fp->rate_min)
fp->rate_min = rate;
else if (rate > fp->rate_max)
if (!fp->rate_max || rate > fp->rate_max)
fp->rate_max = rate;
fp->rates |= snd_pcm_rate_to_rate_bit(rate);
fp->nr_rates++;
}
if (!nonzero_rates) {
if (!fp->nr_rates) {
hwc_debug("All rates were zero. Skipping format!\n");
return -1;
}
Expand Down

0 comments on commit dc07c37

Please sign in to comment.