From c5c6cb715c76db99def5fe5a7a20d2739946c078 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 29 Jul 2021 13:23:18 -0300 Subject: [PATCH] Fix overwritten register index value oversight --- src/sound/snd_ac97_via.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/sound/snd_ac97_via.c b/src/sound/snd_ac97_via.c index 9d46dfccd..1349d0849 100644 --- a/src/sound/snd_ac97_via.c +++ b/src/sound/snd_ac97_via.c @@ -378,18 +378,16 @@ ac97_via_sgd_write(uint16_t addr, uint8_t val, void *priv) if (val & 1) { /* return 0x00 on unaligned reads */ dev->sgd_regs[0x80] = dev->sgd_regs[0x81] = 0x00; } else { - dev->sgd_regs[0x80] = dev->codec_shadow[modem].regs_codec[i][val] = ac97_codec_read(codec, val); - val |= 1; - dev->sgd_regs[0x81] = dev->codec_shadow[modem].regs_codec[i][val] = ac97_codec_read(codec, val); + dev->sgd_regs[0x80] = dev->codec_shadow[modem].regs_codec[i][val] = ac97_codec_read(codec, val); + dev->sgd_regs[0x81] = dev->codec_shadow[modem].regs_codec[i][val | 1] = ac97_codec_read(codec, val | 1); } /* Flag data/status/index for this codec as valid. */ if (val & 0x80) dev->sgd_regs[0x83] |= 0x02 << (i << 1); } else if (!(val & 1)) { /* do nothing on unaligned writes */ - ac97_codec_write(codec, val, dev->codec_shadow[modem].regs_codec[i][val] = dev->sgd_regs[0x80]); - val |= 1; - ac97_codec_write(codec, val, dev->codec_shadow[modem].regs_codec[i][val] = dev->sgd_regs[0x81]); + ac97_codec_write(codec, val, dev->codec_shadow[modem].regs_codec[i][val] = dev->sgd_regs[0x80]); + ac97_codec_write(codec, val | 1, dev->codec_shadow[modem].regs_codec[i][val | 1] = dev->sgd_regs[0x81]); /* Update primary audio codec state if that codec was written to. */ if (!modem && !i)