aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTorsten Schenk <torsten.schenk@zoho.com>2011-04-04 05:47:50 -0400
committerTakashi Iwai <tiwai@suse.de>2011-04-04 06:24:53 -0400
commite220fa3bf503d63039fa8e0398a1c252d24663f9 (patch)
tree53b51f12e43aed6eb0b603edb43cc2a90038e789
parent78caf66cb568f2b0c63bf8f87cff2fe1583dd9d0 (diff)
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>
-rw-r--r--sound/usb/6fire/pcm.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
index ba62c7468ba8..2110cbf35474 100644
--- a/sound/usb/6fire/pcm.c
+++ b/sound/usb/6fire/pcm.c
@@ -456,7 +456,7 @@ static int usb6fire_pcm_close(struct snd_pcm_substream *alsa_sub)
456 /* all substreams closed? if so, stop streaming */ 456 /* all substreams closed? if so, stop streaming */
457 if (!rt->playback.instance && !rt->capture.instance) { 457 if (!rt->playback.instance && !rt->capture.instance) {
458 usb6fire_pcm_stream_stop(rt); 458 usb6fire_pcm_stream_stop(rt);
459 rt->rate = -1; 459 rt->rate = ARRAY_SIZE(rates);
460 } 460 }
461 } 461 }
462 mutex_unlock(&rt->stream_mutex); 462 mutex_unlock(&rt->stream_mutex);
@@ -480,7 +480,6 @@ static int usb6fire_pcm_prepare(struct snd_pcm_substream *alsa_sub)
480 struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub); 480 struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub);
481 struct pcm_substream *sub = usb6fire_pcm_get_substream(alsa_sub); 481 struct pcm_substream *sub = usb6fire_pcm_get_substream(alsa_sub);
482 struct snd_pcm_runtime *alsa_rt = alsa_sub->runtime; 482 struct snd_pcm_runtime *alsa_rt = alsa_sub->runtime;
483 int i;
484 int ret; 483 int ret;
485 484
486 if (rt->panic) 485 if (rt->panic)
@@ -493,12 +492,10 @@ static int usb6fire_pcm_prepare(struct snd_pcm_substream *alsa_sub)
493 sub->period_off = 0; 492 sub->period_off = 0;
494 493
495 if (rt->stream_state == STREAM_DISABLED) { 494 if (rt->stream_state == STREAM_DISABLED) {
496 for (i = 0; i < ARRAY_SIZE(rates); i++) 495 for (rt->rate = 0; rt->rate < ARRAY_SIZE(rates); rt->rate++)
497 if (alsa_rt->rate == rates[i]) { 496 if (alsa_rt->rate == rates[rt->rate])
498 rt->rate = i;
499 break; 497 break;
500 } 498 if (rt->rate == ARRAY_SIZE(rates)) {
501 if (i == ARRAY_SIZE(rates)) {
502 mutex_unlock(&rt->stream_mutex); 499 mutex_unlock(&rt->stream_mutex);
503 snd_printk("invalid rate %d in prepare.\n", 500 snd_printk("invalid rate %d in prepare.\n",
504 alsa_rt->rate); 501 alsa_rt->rate);
@@ -613,7 +610,7 @@ int __devinit usb6fire_pcm_init(struct sfire_chip *chip)
613 610
614 rt->chip = chip; 611 rt->chip = chip;
615 rt->stream_state = STREAM_DISABLED; 612 rt->stream_state = STREAM_DISABLED;
616 rt->rate = -1; 613 rt->rate = ARRAY_SIZE(rates);
617 init_waitqueue_head(&rt->stream_wait_queue); 614 init_waitqueue_head(&rt->stream_wait_queue);
618 mutex_init(&rt->stream_mutex); 615 mutex_init(&rt->stream_mutex);
619 616