提交 8121d91c 编写于 作者: D Dan Carpenter 提交者: Takashi Iwai

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: NDan Carpenter <error27@gmail.com>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 ea18e137
...@@ -493,13 +493,12 @@ static int usb6fire_pcm_prepare(struct snd_pcm_substream *alsa_sub) ...@@ -493,13 +493,12 @@ static int usb6fire_pcm_prepare(struct snd_pcm_substream *alsa_sub)
sub->period_off = 0; sub->period_off = 0;
if (rt->stream_state == STREAM_DISABLED) { if (rt->stream_state == STREAM_DISABLED) {
rt->rate = -1;
for (i = 0; i < ARRAY_SIZE(rates); i++) for (i = 0; i < ARRAY_SIZE(rates); i++)
if (alsa_rt->rate == rates[i]) { if (alsa_rt->rate == rates[i]) {
rt->rate = i; rt->rate = i;
break; break;
} }
if (rt->rate == -1) { if (i == ARRAY_SIZE(rates)) {
mutex_unlock(&rt->stream_mutex); mutex_unlock(&rt->stream_mutex);
snd_printk("invalid rate %d in prepare.\n", snd_printk("invalid rate %d in prepare.\n",
alsa_rt->rate); alsa_rt->rate);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册