From: Daniel Mack Date: Thu, 3 Jul 2014 14:51:36 +0000 (+0200) Subject: ASoC: adau1701: fix adau1701_reg_read() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=3ad80b828b2533f37c221e2df155774efd6ed814;p=linux-beck.git ASoC: adau1701: fix adau1701_reg_read() Fix a long standing bug in the read register routing of adau1701. The bytes arrive in the buffer in big-endian, so the result has to be shifted before and-ing the bytes in the loop. Signed-off-by: Daniel Mack Acked-by: Lars-Peter Clausen Signed-off-by: Mark Brown Cc: stable@vger.kernel.org --- diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c index d71c59cf7bdd..370b742117ef 100644 --- a/sound/soc/codecs/adau1701.c +++ b/sound/soc/codecs/adau1701.c @@ -230,8 +230,10 @@ static int adau1701_reg_read(void *context, unsigned int reg, *value = 0; - for (i = 0; i < size; i++) - *value |= recv_buf[i] << (i * 8); + for (i = 0; i < size; i++) { + *value <<= 8; + *value |= recv_buf[i]; + } return 0; }