mirror of
https://github.com/torvalds/linux
synced 2024-09-21 11:38:48 +00:00
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>
This commit is contained in:
parent
78caf66cb5
commit
e220fa3bf5
|
@ -456,7 +456,7 @@ static int usb6fire_pcm_close(struct snd_pcm_substream *alsa_sub)
|
||||||
/* all substreams closed? if so, stop streaming */
|
/* all substreams closed? if so, stop streaming */
|
||||||
if (!rt->playback.instance && !rt->capture.instance) {
|
if (!rt->playback.instance && !rt->capture.instance) {
|
||||||
usb6fire_pcm_stream_stop(rt);
|
usb6fire_pcm_stream_stop(rt);
|
||||||
rt->rate = -1;
|
rt->rate = ARRAY_SIZE(rates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mutex_unlock(&rt->stream_mutex);
|
mutex_unlock(&rt->stream_mutex);
|
||||||
|
@ -480,7 +480,6 @@ static int usb6fire_pcm_prepare(struct snd_pcm_substream *alsa_sub)
|
||||||
struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub);
|
struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub);
|
||||||
struct pcm_substream *sub = usb6fire_pcm_get_substream(alsa_sub);
|
struct pcm_substream *sub = usb6fire_pcm_get_substream(alsa_sub);
|
||||||
struct snd_pcm_runtime *alsa_rt = alsa_sub->runtime;
|
struct snd_pcm_runtime *alsa_rt = alsa_sub->runtime;
|
||||||
int i;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (rt->panic)
|
if (rt->panic)
|
||||||
|
@ -493,12 +492,10 @@ 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) {
|
||||||
for (i = 0; i < ARRAY_SIZE(rates); i++)
|
for (rt->rate = 0; rt->rate < ARRAY_SIZE(rates); rt->rate++)
|
||||||
if (alsa_rt->rate == rates[i]) {
|
if (alsa_rt->rate == rates[rt->rate])
|
||||||
rt->rate = i;
|
|
||||||
break;
|
break;
|
||||||
}
|
if (rt->rate == ARRAY_SIZE(rates)) {
|
||||||
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);
|
||||||
|
@ -613,7 +610,7 @@ int __devinit usb6fire_pcm_init(struct sfire_chip *chip)
|
||||||
|
|
||||||
rt->chip = chip;
|
rt->chip = chip;
|
||||||
rt->stream_state = STREAM_DISABLED;
|
rt->stream_state = STREAM_DISABLED;
|
||||||
rt->rate = -1;
|
rt->rate = ARRAY_SIZE(rates);
|
||||||
init_waitqueue_head(&rt->stream_wait_queue);
|
init_waitqueue_head(&rt->stream_wait_queue);
|
||||||
mutex_init(&rt->stream_mutex);
|
mutex_init(&rt->stream_mutex);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue