From 703aa87cbf4fde8f12ef47655562c92cccafe24b Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 23:15:39 -0300 Subject: [PATCH] Fix VIA AC97 warning --- src/sound/snd_ac97_via.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/sound/snd_ac97_via.c b/src/sound/snd_ac97_via.c index 1707c0c9a..2ca80e538 100644 --- a/src/sound/snd_ac97_via.c +++ b/src/sound/snd_ac97_via.c @@ -176,7 +176,8 @@ ac97_via_update_irqs(ac97_via_t *dev) static void -ac97_via_update_codec(ac97_via_t *dev) { +ac97_via_update_codec(ac97_via_t *dev) +{ /* Get primary audio codec. */ ac97_codec_t *codec = dev->codec[0][0]; @@ -378,16 +379,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); - dev->sgd_regs[0x81] = dev->codec_shadow[modem].regs_codec[i][val | 1] = ac97_codec_read(codec, val | 1); + dev->sgd_regs[0x80] = dev->codec_shadow[modem].regs_codec[i][(val & 0x7f)] = ac97_codec_read(codec, val); + dev->sgd_regs[0x81] = dev->codec_shadow[modem].regs_codec[i][(val & 0x7f) | 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]); - ac97_codec_write(codec, val | 1, dev->codec_shadow[modem].regs_codec[i][val | 1] = dev->sgd_regs[0x81]); + ac97_codec_write(codec, val, dev->codec_shadow[modem].regs_codec[i][(val & 0x7f)] = dev->sgd_regs[0x80]); + ac97_codec_write(codec, val | 1, dev->codec_shadow[modem].regs_codec[i][(val & 0x7f) | 1] = dev->sgd_regs[0x81]); /* Update primary audio codec state if that codec was written to. */ if (!modem && !i)