aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2011-02-07 12:25:19 -0500
committerTakashi Iwai <tiwai@suse.de>2011-02-07 12:30:10 -0500
commit8121d91c02a1be4884821599472acf405efdc3de (patch)
treeb256c95edfa535ab4d33dc8411a332334f2b5df4 /sound/usb
parentea18e137baf3e3e9212bfd7b071555fc712159b5 (diff)
ALSA: USB: 6fire: signedness bug in usb6fire_pcm_prepare()
rt->rate is an unsigned char so it's never equal to -1. It's not a huge problem because the invalid rate is caught inside the call to usb6fire_pcm_set_rate() which returns -EINVAL. But if we fix the test then it prints out the correct error message so that's good. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/6fire/pcm.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
index 705c88e1964c..ba62c7468ba8 100644
--- a/sound/usb/6fire/pcm.c
+++ b/sound/usb/6fire/pcm.c
@@ -493,13 +493,12 @@ static int usb6fire_pcm_prepare(struct snd_pcm_substream *alsa_sub)
493 sub->period_off = 0; 493 sub->period_off = 0;
494 494
495 if (rt->stream_state == STREAM_DISABLED) { 495 if (rt->stream_state == STREAM_DISABLED) {
496 rt->rate = -1;
497 for (i = 0; i < ARRAY_SIZE(rates); i++) 496 for (i = 0; i < ARRAY_SIZE(rates); i++)
498 if (alsa_rt->rate == rates[i]) { 497 if (alsa_rt->rate == rates[i]) {
499 rt->rate = i; 498 rt->rate = i;
500 break; 499 break;
501 } 500 }
502 if (rt->rate == -1) { 501 if (i == ARRAY_SIZE(rates)) {
503 mutex_unlock(&rt->stream_mutex); 502 mutex_unlock(&rt->stream_mutex);
504 snd_printk("invalid rate %d in prepare.\n", 503 snd_printk("invalid rate %d in prepare.\n",
505 alsa_rt->rate); 504 alsa_rt->rate);