Commit e220fa3bf503d63039fa8e0398a1c252d24663f9

Authored by Torsten Schenk
Committed by Takashi Iwai
1 parent 78caf66cb5

ALSA: 6fire - Fix pcm rate assignment

Completion of signedness bug for pcm_runtime.rate: variable will never
get assigned a negative value now.

Signed-off-by: Torsten Schenk <torsten.schenk@zoho.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

Showing 1 changed file with 5 additions and 8 deletions Side-by-side Diff

sound/usb/6fire/pcm.c
... ... @@ -456,7 +456,7 @@
456 456 /* all substreams closed? if so, stop streaming */
457 457 if (!rt->playback.instance && !rt->capture.instance) {
458 458 usb6fire_pcm_stream_stop(rt);
459   - rt->rate = -1;
  459 + rt->rate = ARRAY_SIZE(rates);
460 460 }
461 461 }
462 462 mutex_unlock(&rt->stream_mutex);
... ... @@ -480,7 +480,6 @@
480 480 struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub);
481 481 struct pcm_substream *sub = usb6fire_pcm_get_substream(alsa_sub);
482 482 struct snd_pcm_runtime *alsa_rt = alsa_sub->runtime;
483   - int i;
484 483 int ret;
485 484  
486 485 if (rt->panic)
487 486  
... ... @@ -493,12 +492,10 @@
493 492 sub->period_off = 0;
494 493  
495 494 if (rt->stream_state == STREAM_DISABLED) {
496   - for (i = 0; i < ARRAY_SIZE(rates); i++)
497   - if (alsa_rt->rate == rates[i]) {
498   - rt->rate = i;
  495 + for (rt->rate = 0; rt->rate < ARRAY_SIZE(rates); rt->rate++)
  496 + if (alsa_rt->rate == rates[rt->rate])
499 497 break;
500   - }
501   - if (i == ARRAY_SIZE(rates)) {
  498 + if (rt->rate == ARRAY_SIZE(rates)) {
502 499 mutex_unlock(&rt->stream_mutex);
503 500 snd_printk("invalid rate %d in prepare.\n",
504 501 alsa_rt->rate);
... ... @@ -613,7 +610,7 @@
613 610  
614 611 rt->chip = chip;
615 612 rt->stream_state = STREAM_DISABLED;
616   - rt->rate = -1;
  613 + rt->rate = ARRAY_SIZE(rates);
617 614 init_waitqueue_head(&rt->stream_wait_queue);
618 615 mutex_init(&rt->stream_mutex);
619 616