aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/rt5677-spi.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-06-13 17:33:34 +0200
committerTakashi Iwai <tiwai@suse.de>2019-06-13 17:33:34 +0200
commit84396d141894c52f55c1276630587862f5ced7dd (patch)
tree444043322d1afe7502b8bad825c0097502a83ddb /sound/soc/codecs/rt5677-spi.c
parentALSA: ice1712: Check correct return value to snd_i2c_sendbytes (EWS/DMX 6Fire) (diff)
parentASoC: Intel: sst: fix kmalloc call with wrong flags (diff)
downloadlinux-dev-84396d141894c52f55c1276630587862f5ced7dd.tar.xz
linux-dev-84396d141894c52f55c1276630587862f5ced7dd.zip
Merge tag 'asoc-fix-v5.2-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v5.2 There's an awful lot of fixes here, almost all for the newly introduced SoF DSP drivers (including a few things it turned up in shared code). This is a large and complex piece of code so it's not surprising that there have been quite a few issues here, fortunately things seem to have mostly calmed down now. Otherwise there's just a smattering of small fixes.
Diffstat (limited to 'sound/soc/codecs/rt5677-spi.c')
-rw-r--r--sound/soc/codecs/rt5677-spi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sound/soc/codecs/rt5677-spi.c b/sound/soc/codecs/rt5677-spi.c
index 84b6bd8b50e1..a4dfa0345c6e 100644
--- a/sound/soc/codecs/rt5677-spi.c
+++ b/sound/soc/codecs/rt5677-spi.c
@@ -101,7 +101,7 @@ static void rt5677_spi_reverse(u8 *dst, u32 dstlen, const u8 *src, u32 srclen)
u32 word_size = min_t(u32, dstlen, 8);
for (w = 0; w < dstlen; w += word_size) {
- for (i = 0; i < word_size; i++) {
+ for (i = 0; i < word_size && i + w < dstlen; i++) {
si = w + word_size - i - 1;
dst[w + i] = si < srclen ? src[si] : 0;
}
@@ -152,8 +152,9 @@ int rt5677_spi_read(u32 addr, void *rxbuf, size_t len)
status |= spi_sync(g_spi, &m);
mutex_unlock(&spi_mutex);
+
/* Copy data back to caller buffer */
- rt5677_spi_reverse(cb + offset, t[1].len, body, t[1].len);
+ rt5677_spi_reverse(cb + offset, len - offset, body, t[1].len);
}
return status;
}