mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-12 00:38:55 +00:00
ASoC: soc-cache: Add error checking in the *_cache_sync functions
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> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
d482337eab
commit
7a33d4ce82
@ -792,7 +792,6 @@ static struct snd_soc_rbtree_node *snd_soc_rbtree_lookup(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int snd_soc_rbtree_insert(struct rb_root *root,
|
static int snd_soc_rbtree_insert(struct rb_root *root,
|
||||||
struct snd_soc_rbtree_node *rbnode)
|
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 rb_node *node;
|
||||||
struct snd_soc_rbtree_node *rbnode;
|
struct snd_soc_rbtree_node *rbnode;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
int ret;
|
||||||
|
|
||||||
rbtree_ctx = codec->reg_cache;
|
rbtree_ctx = codec->reg_cache;
|
||||||
for (node = rb_first(&rbtree_ctx->root); node; node = rb_next(node)) {
|
for (node = rb_first(&rbtree_ctx->root); node; node = rb_next(node)) {
|
||||||
rbnode = rb_entry(node, struct snd_soc_rbtree_node, node);
|
rbnode = rb_entry(node, struct snd_soc_rbtree_node, node);
|
||||||
if (rbnode->value == rbnode->defval)
|
if (rbnode->value == rbnode->defval)
|
||||||
continue;
|
continue;
|
||||||
snd_soc_cache_read(codec, rbnode->reg, &val);
|
ret = snd_soc_cache_read(codec, rbnode->reg, &val);
|
||||||
snd_soc_write(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",
|
dev_dbg(codec->dev, "Synced register %#x, value = %#x\n",
|
||||||
rbnode->reg, val);
|
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;
|
struct snd_soc_lzo_ctx **lzo_blocks;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
int i;
|
int i;
|
||||||
|
int ret;
|
||||||
|
|
||||||
lzo_blocks = codec->reg_cache;
|
lzo_blocks = codec->reg_cache;
|
||||||
for_each_set_bit(i, lzo_blocks[0]->sync_bmp, lzo_blocks[0]->sync_bmp_nbits) {
|
for_each_set_bit(i, lzo_blocks[0]->sync_bmp, lzo_blocks[0]->sync_bmp_nbits) {
|
||||||
snd_soc_cache_read(codec, i, &val);
|
ret = snd_soc_cache_read(codec, i, &val);
|
||||||
snd_soc_write(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",
|
dev_dbg(codec->dev, "Synced register %#x, value = %#x\n",
|
||||||
i, val);
|
i, val);
|
||||||
}
|
}
|
||||||
@ -1390,12 +1399,15 @@ err_tofree:
|
|||||||
static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
|
static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
int ret;
|
||||||
struct snd_soc_codec_driver *codec_drv;
|
struct snd_soc_codec_driver *codec_drv;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
codec_drv = codec->driver;
|
codec_drv = codec->driver;
|
||||||
for (i = 0; i < codec_drv->reg_cache_size; ++i) {
|
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) {
|
if (codec_drv->reg_cache_default) {
|
||||||
switch (codec_drv->reg_word_size) {
|
switch (codec_drv->reg_word_size) {
|
||||||
case 1: {
|
case 1: {
|
||||||
@ -1418,7 +1430,9 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
|
|||||||
BUG();
|
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",
|
dev_dbg(codec->dev, "Synced register %#x, value = %#x\n",
|
||||||
i, val);
|
i, val);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user