ChangeSet 1.2181.25.3, 2005/03/22 08:55:39+01:00, [EMAIL PROTECTED]
[ALSA] Fix voice allocation corruption
EMU10K1/EMU10K2 driver
Fixed the corrupted voice allocation in snd_emu10k1_pcm_channel_alloc().
Signed-off-by: Takashi Iwai <[EMAIL PROTECTED]>
emupcm.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff -Nru a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
--- a/sound/pci/emu10k1/emupcm.c 2005-03-30 16:09:35 -08:00
+++ b/sound/pci/emu10k1/emupcm.c 2005-03-30 16:09:35 -08:00
@@ -109,14 +109,17 @@
snd_emu10k1_voice_free(epcm->emu, epcm->voices[1]);
epcm->voices[1] = NULL;
}
- if (voices == 1 && epcm->voices[0] != NULL)
- return 0; /* already allocated */
- if (voices == 2 && epcm->voices[0] != NULL && epcm->voices[1] != NULL)
- return 0;
- if (voices > 1) {
- if (epcm->voices[0] != NULL && epcm->voices[1] == NULL) {
- snd_emu10k1_voice_free(epcm->emu, epcm->voices[0]);
- epcm->voices[0] = NULL;
+ for (i = 0; i < voices; i++) {
+ if (epcm->voices[i] == NULL)
+ break;
+ }
+ if (i == voices)
+ return 0; /* already allocated */
+
+ for (i = 0; i < ARRAY_SIZE(epcm->voices); i++) {
+ if (epcm->voices[i]) {
+ snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]);
+ epcm->voices[i] = NULL;
}
}
err = snd_emu10k1_voice_alloc(epcm->emu,
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html