linux-stable/sound
Giacomo Guiduzzi c2052ad0c7 ALSA: pci: fix reading of swapped values from pcmreg in AC97 codec
commit 17aaf01933 upstream.

Tests 72 and 78 for ALSA in kselftest fail due to reading
inconsistent values from some devices on a VirtualBox
Virtual Machine using the snd_intel8x0 driver for the AC'97
Audio Controller device.
Taking for example test number 72, this is what the test reports:
"Surround Playback Volume.0 expected 1 but read 0, is_volatile 0"
"Surround Playback Volume.1 expected 0 but read 1, is_volatile 0"
These errors repeat for each value from 0 to 31.

Taking a look at these error messages it is possible to notice
that the written values are read back swapped.
When the write is performed, these values are initially stored in
an array used to sanity-check them and write them in the pcmreg
array. To write them, the two one-byte values are packed together
in a two-byte variable through bitwise operations: the first
value is shifted left by one byte and the second value is stored in the
right byte through a bitwise OR. When reading the values back,
right shifts are performed to retrieve the previously stored
bytes. These shifts are executed in the wrong order, thus
reporting the values swapped as shown above.

This patch fixes this mistake by reversing the read
operations' order.

Signed-off-by: Giacomo Guiduzzi <guiduzzi.giacomo@gmail.com>
Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220322200653.15862-1-guiduzzi.giacomo@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-03-28 09:58:44 +02:00
..
ac97 bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
aoa Kbuild updates for v5.15 2021-09-03 15:33:47 -07:00
arm ALSA: pxa2xx: Use managed PCM buffer allocation 2021-08-04 08:08:21 +02:00
atmel
core ALSA: pcm: Add stream lock during PCM reset ioctl operations 2022-03-28 09:58:44 +02:00
drivers ALSA: drivers: opl3: Fix incorrect use of vp->state 2021-12-29 12:28:50 +01:00
firewire ALSA: oxfw: fix functional regression for Mackie Onyx 1640i in v5.14 or later 2021-11-18 19:16:57 +01:00
hda ALSA: hda: Make proper use of timecounter 2022-01-27 11:04:07 +01:00
i2c ALSA: i2c: tea6330t: Remove redundant initialization of variable err 2021-06-12 09:32:14 +02:00
isa ALSA: gus: fix null pointer dereference on pointer block 2021-11-25 09:48:30 +01:00
mips ALSA: n64: check return value after calling platform_get_resource() 2021-06-12 09:31:13 +02:00
oss sound/oss/dmasound: Remove superfluous "break" 2021-05-27 08:24:23 +02:00
parisc parisc architecture updates for kernel 5.15: 2021-09-02 13:16:00 -07:00
pci ALSA: pci: fix reading of swapped values from pcmreg in AC97 codec 2022-03-28 09:58:44 +02:00
pcmcia ALSA: vx: Manage vx_core object with devres 2021-07-19 16:17:09 +02:00
ppc ALSA: ppc: fix error return code in snd_pmac_probe() 2021-06-16 08:52:29 +02:00
sh
soc ASoC: sti: Fix deadlock via snd_pcm_stop_xrun() call 2022-03-28 09:58:43 +02:00
sparc ALSA: sparc: Fix assignment in if condition 2021-06-09 17:30:29 +02:00
spi
synth ALSA: synth: missing check for possible NULL after the call to kstrdup 2021-11-18 19:15:55 +01:00
usb ALSA: usb-audio: Add mute TLV for playback volumes on RODE NT-USB 2022-03-28 09:58:44 +02:00
virtio
x86 ALSA: intel_hdmi: Fix reference to PCM buffer address 2022-03-08 19:12:42 +01:00
xen
Kconfig
Makefile
ac97_bus.c
last.c
sound_core.c