ASoC: fix ak4104 register array access

Don't touch the variable 'reg' to construct the value for the actual SPI
transport. This variable is again used to access the driver's register
cache, and so random memory is overwritten.
Compute the value in-place instead.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: stable@kernel.org
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

authored by Daniel Mack and committed by Mark Brown e555317c bb1c0478

+2 -4
+2 -4
sound/soc/codecs/ak4104.c
··· 90 if (reg >= codec->reg_cache_size) 91 return -EINVAL; 92 93 - reg &= AK4104_REG_MASK; 94 - reg |= AK4104_WRITE; 95 - 96 /* only write to the hardware if value has changed */ 97 if (cache[reg] != value) { 98 - u8 tmp[2] = { reg, value }; 99 if (spi_write(spi, tmp, sizeof(tmp))) { 100 dev_err(&spi->dev, "SPI write failed\n"); 101 return -EIO;
··· 90 if (reg >= codec->reg_cache_size) 91 return -EINVAL; 92 93 /* only write to the hardware if value has changed */ 94 if (cache[reg] != value) { 95 + u8 tmp[2] = { (reg & AK4104_REG_MASK) | AK4104_WRITE, value }; 96 + 97 if (spi_write(spi, tmp, sizeof(tmp))) { 98 dev_err(&spi->dev, "SPI write failed\n"); 99 return -EIO;