aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/soc-cache.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 6c0589e3fefb..e5b18889a493 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(
792 return NULL; 792 return NULL;
793} 793}
794 794
795
796static int snd_soc_rbtree_insert(struct rb_root *root, 795static int snd_soc_rbtree_insert(struct rb_root *root,
797 struct snd_soc_rbtree_node *rbnode) 796 struct snd_soc_rbtree_node *rbnode)
798{ 797{
@@ -826,14 +825,19 @@ static int snd_soc_rbtree_cache_sync(struct snd_soc_codec *codec)
826 struct rb_node *node; 825 struct rb_node *node;
827 struct snd_soc_rbtree_node *rbnode; 826 struct snd_soc_rbtree_node *rbnode;
828 unsigned int val; 827 unsigned int val;
828 int ret;
829 829
830 rbtree_ctx = codec->reg_cache; 830 rbtree_ctx = codec->reg_cache;
831 for (node = rb_first(&rbtree_ctx->root); node; node = rb_next(node)) { 831 for (node = rb_first(&rbtree_ctx->root); node; node = rb_next(node)) {
832 rbnode = rb_entry(node, struct snd_soc_rbtree_node, node); 832 rbnode = rb_entry(node, struct snd_soc_rbtree_node, node);
833 if (rbnode->value == rbnode->defval) 833 if (rbnode->value == rbnode->defval)
834 continue; 834 continue;
835 snd_soc_cache_read(codec, rbnode->reg, &val); 835 ret = snd_soc_cache_read(codec, rbnode->reg, &val);
836 snd_soc_write(codec, rbnode->reg, val); 836 if (ret)
837 return ret;
838 ret = snd_soc_write(codec, rbnode->reg, val);
839 if (ret)
840 return ret;
837 dev_dbg(codec->dev, "Synced register %#x, value = %#x\n", 841 dev_dbg(codec->dev, "Synced register %#x, value = %#x\n",
838 rbnode->reg, val); 842 rbnode->reg, val);
839 } 843 }
@@ -1110,11 +1114,16 @@ static int snd_soc_lzo_cache_sync(struct snd_soc_codec *codec)
1110 struct snd_soc_lzo_ctx **lzo_blocks; 1114 struct snd_soc_lzo_ctx **lzo_blocks;
1111 unsigned int val; 1115 unsigned int val;
1112 int i; 1116 int i;
1117 int ret;
1113 1118
1114 lzo_blocks = codec->reg_cache; 1119 lzo_blocks = codec->reg_cache;
1115 for_each_set_bit(i, lzo_blocks[0]->sync_bmp, lzo_blocks[0]->sync_bmp_nbits) { 1120 for_each_set_bit(i, lzo_blocks[0]->sync_bmp, lzo_blocks[0]->sync_bmp_nbits) {
1116 snd_soc_cache_read(codec, i, &val); 1121 ret = snd_soc_cache_read(codec, i, &val);
1117 snd_soc_write(codec, i, val); 1122 if (ret)
1123 return ret;
1124 ret = snd_soc_write(codec, i, val);
1125 if (ret)
1126 return ret;
1118 dev_dbg(codec->dev, "Synced register %#x, value = %#x\n", 1127 dev_dbg(codec->dev, "Synced register %#x, value = %#x\n",
1119 i, val); 1128 i, val);
1120 } 1129 }
@@ -1390,12 +1399,15 @@ err_tofree:
1390static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec) 1399static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
1391{ 1400{
1392 int i; 1401 int i;
1402 int ret;
1393 struct snd_soc_codec_driver *codec_drv; 1403 struct snd_soc_codec_driver *codec_drv;
1394 unsigned int val; 1404 unsigned int val;
1395 1405
1396 codec_drv = codec->driver; 1406 codec_drv = codec->driver;
1397 for (i = 0; i < codec_drv->reg_cache_size; ++i) { 1407 for (i = 0; i < codec_drv->reg_cache_size; ++i) {
1398 snd_soc_cache_read(codec, i, &val); 1408 ret = snd_soc_cache_read(codec, i, &val);
1409 if (ret)
1410 return ret;
1399 if (codec_drv->reg_cache_default) { 1411 if (codec_drv->reg_cache_default) {
1400 switch (codec_drv->reg_word_size) { 1412 switch (codec_drv->reg_word_size) {
1401 case 1: { 1413 case 1: {
@@ -1418,7 +1430,9 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
1418 BUG(); 1430 BUG();
1419 } 1431 }
1420 } 1432 }
1421 snd_soc_write(codec, i, val); 1433 ret = snd_soc_write(codec, i, val);
1434 if (ret)
1435 return ret;
1422 dev_dbg(codec->dev, "Synced register %#x, value = %#x\n", 1436 dev_dbg(codec->dev, "Synced register %#x, value = %#x\n",
1423 i, val); 1437 i, val);
1424 } 1438 }