Skip to content

Commit

Permalink
ASoC: Return -1 instead of -EINVAL to ensure consistency
Browse files Browse the repository at this point in the history
The code can't really cope with I/O errors, so it would be better
to be consistent throughout all cache functions and return -1 instead
of -EINVAL.

The return value of snd_soc_read(...) is mostly checked in the probe
function and nowhere else.

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>
  • Loading branch information
Dimitris Papastamos authored and Mark Brown committed Sep 22, 2010
1 parent 321de0d commit 391d8a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sound/soc/soc-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static unsigned int snd_soc_8_16_read(struct snd_soc_codec *codec,
if (reg >= codec->driver->reg_cache_size ||
snd_soc_codec_volatile_register(codec, reg)) {
if (codec->cache_only)
return -EINVAL;
return -1;

return codec->hw_read(codec, reg);
} else {
Expand Down Expand Up @@ -455,7 +455,7 @@ static unsigned int snd_soc_16_16_read(struct snd_soc_codec *codec,
if (reg >= codec->driver->reg_cache_size ||
snd_soc_codec_volatile_register(codec, reg)) {
if (codec->cache_only)
return -EINVAL;
return -1;

return codec->hw_read(codec, reg);
}
Expand Down

0 comments on commit 391d8a0

Please sign in to comment.