All of lore.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@gmail.com>
To: alsa-devel@alsa-project.org
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Timur Tabi <timur@freescale.com>,
	"Arnaud Patard (Rtp)" <arnaud.patard@rtp-net.org>,
	Liam Girdwood <lrg@ti.com>
Subject: [PATCH 2/2] ASoC: cs42l51: Fix off-by-one for reg_cache_size
Date: Wed, 23 Nov 2011 12:46:11 +0800	[thread overview]
Message-ID: <1322023571.6782.4.camel@phoenix> (raw)
In-Reply-To: <1322023485.6782.2.camel@phoenix>

Just checking the code in cs42l51_fill_cache():
The cache pointer points to codec->reg_cache + 1.
I think it is because CS42L51_FIRSTREG is 0x01,
so codec->reg_cache[0] is not used here.

Then we read CS42L51_NUMREGS bytes to cache.
So we need reg_cache_size to be CS42L51_NUMREGS + 1.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 sound/soc/codecs/cs42l51.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c
index 35c5ac3..c0b0a39 100644
--- a/sound/soc/codecs/cs42l51.c
+++ b/sound/soc/codecs/cs42l51.c
@@ -553,7 +553,7 @@ static int cs42l51_probe(struct snd_soc_codec *codec)
 
 static struct snd_soc_codec_driver soc_codec_device_cs42l51 = {
 	.probe =	cs42l51_probe,
-	.reg_cache_size = CS42L51_NUMREGS,
+	.reg_cache_size = CS42L51_NUMREGS + 1,
 	.reg_word_size = sizeof(u8),
 };
 
-- 
1.7.5.4

  reply	other threads:[~2011-11-23  4:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-23  4:44 [PATCH 1/2] ASoC: cs42l51: Clear CS42L51_MIC_POWER_CTL_AUTO bit for MODE_SLAVE and MODE_MASTER Axel Lin
2011-11-23  4:46 ` Axel Lin [this message]
2011-11-23 11:37   ` [PATCH 2/2] ASoC: cs42l51: Fix off-by-one for reg_cache_size Mark Brown
2011-11-23 11:50 ` [PATCH 1/2] ASoC: cs42l51: Clear CS42L51_MIC_POWER_CTL_AUTO bit for MODE_SLAVE and MODE_MASTER Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322023571.6782.4.camel@phoenix \
    --to=axel.lin@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnaud.patard@rtp-net.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=lars@metafoo.de \
    --cc=lrg@ti.com \
    --cc=timur@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.