All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: soc-cache: Add error checking in the *_cache_sync functions
@ 2010-11-29 10:24 Dimitris Papastamos
  2010-11-29 11:19 ` Liam Girdwood
  2010-11-29 13:13 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Dimitris Papastamos @ 2010-11-29 10:24 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, patches

Ensure that we report any errors encountered during reads/writes
in the cache syncing functions.

Remove redundant newline in the source code.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
 sound/soc/soc-cache.c |   28 +++++++++++++++++++++-------
 1 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 6c0589e..e5b1888 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -792,7 +792,6 @@ static struct snd_soc_rbtree_node *snd_soc_rbtree_lookup(
 	return NULL;
 }
 
-
 static int snd_soc_rbtree_insert(struct rb_root *root,
 				 struct snd_soc_rbtree_node *rbnode)
 {
@@ -826,14 +825,19 @@ static int snd_soc_rbtree_cache_sync(struct snd_soc_codec *codec)
 	struct rb_node *node;
 	struct snd_soc_rbtree_node *rbnode;
 	unsigned int val;
+	int ret;
 
 	rbtree_ctx = codec->reg_cache;
 	for (node = rb_first(&rbtree_ctx->root); node; node = rb_next(node)) {
 		rbnode = rb_entry(node, struct snd_soc_rbtree_node, node);
 		if (rbnode->value == rbnode->defval)
 			continue;
-		snd_soc_cache_read(codec, rbnode->reg, &val);
-		snd_soc_write(codec, rbnode->reg, val);
+		ret = snd_soc_cache_read(codec, rbnode->reg, &val);
+		if (ret)
+			return ret;
+		ret = snd_soc_write(codec, rbnode->reg, val);
+		if (ret)
+			return ret;
 		dev_dbg(codec->dev, "Synced register %#x, value = %#x\n",
 			rbnode->reg, val);
 	}
@@ -1110,11 +1114,16 @@ static int snd_soc_lzo_cache_sync(struct snd_soc_codec *codec)
 	struct snd_soc_lzo_ctx **lzo_blocks;
 	unsigned int val;
 	int i;
+	int ret;
 
 	lzo_blocks = codec->reg_cache;
 	for_each_set_bit(i, lzo_blocks[0]->sync_bmp, lzo_blocks[0]->sync_bmp_nbits) {
-		snd_soc_cache_read(codec, i, &val);
-		snd_soc_write(codec, i, val);
+		ret = snd_soc_cache_read(codec, i, &val);
+		if (ret)
+			return ret;
+		ret = snd_soc_write(codec, i, val);
+		if (ret)
+			return ret;
 		dev_dbg(codec->dev, "Synced register %#x, value = %#x\n",
 			i, val);
 	}
@@ -1390,12 +1399,15 @@ err_tofree:
 static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
 {
 	int i;
+	int ret;
 	struct snd_soc_codec_driver *codec_drv;
 	unsigned int val;
 
 	codec_drv = codec->driver;
 	for (i = 0; i < codec_drv->reg_cache_size; ++i) {
-		snd_soc_cache_read(codec, i, &val);
+		ret = snd_soc_cache_read(codec, i, &val);
+		if (ret)
+			return ret;
 		if (codec_drv->reg_cache_default) {
 			switch (codec_drv->reg_word_size) {
 			case 1: {
@@ -1418,7 +1430,9 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
 				BUG();
 			}
 		}
-		snd_soc_write(codec, i, val);
+		ret = snd_soc_write(codec, i, val);
+		if (ret)
+			return ret;
 		dev_dbg(codec->dev, "Synced register %#x, value = %#x\n",
 			i, val);
 	}
-- 
1.7.3.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: soc-cache: Add error checking in the *_cache_sync functions
  2010-11-29 10:24 [PATCH] ASoC: soc-cache: Add error checking in the *_cache_sync functions Dimitris Papastamos
@ 2010-11-29 11:19 ` Liam Girdwood
  2010-11-29 13:13 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2010-11-29 11:19 UTC (permalink / raw)
  To: Dimitris Papastamos; +Cc: alsa-devel, Mark Brown, patches

On Mon, 2010-11-29 at 10:24 +0000, Dimitris Papastamos wrote:
> Ensure that we report any errors encountered during reads/writes
> in the cache syncing functions.
> 
> Remove redundant newline in the source code.
> 
> Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
> ---

Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: soc-cache: Add error checking in the *_cache_sync functions
  2010-11-29 10:24 [PATCH] ASoC: soc-cache: Add error checking in the *_cache_sync functions Dimitris Papastamos
  2010-11-29 11:19 ` Liam Girdwood
@ 2010-11-29 13:13 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2010-11-29 13:13 UTC (permalink / raw)
  To: Dimitris Papastamos; +Cc: alsa-devel, patches, Liam Girdwood

On Mon, Nov 29, 2010 at 10:24:54AM +0000, Dimitris Papastamos wrote:
> Ensure that we report any errors encountered during reads/writes
> in the cache syncing functions.
> 
> Remove redundant newline in the source code.
> 
> Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-29 13:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-29 10:24 [PATCH] ASoC: soc-cache: Add error checking in the *_cache_sync functions Dimitris Papastamos
2010-11-29 11:19 ` Liam Girdwood
2010-11-29 13:13 ` Mark Brown

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.