Skip to contentSkip to conversation

ASoC: Return -1 instead of -EINVAL to ensure consistency

PATCH Applied Dimitris Papastamos 3 participants 3 messages Sep 21, 2010 – Sep 22, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: Return -1 instead of -EINVAL to ensure consistency

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.

---
 sound/soc/soc-cache.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
sound/soc/soc-cache.c +2 -2
index 28bf1ff..6702a3d 100644
@@ -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 {
@@ -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);
 	}
Signature · 1 line
1.7.3
Acked-by on v1 1/1
#1 lore raw
Quoted 24 lines · Dimitris Papastamos

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.

---
 sound/soc/soc-cache.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
sound/soc/soc-cache.c +1 -1
index 28bf1ff..6702a3d 100644
@@ -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 {

sound/soc/soc-cache.c static unsigned int snd_soc_16_16_read(struct snd_soc_codec *codec, · line 461

Quoted 8 lines
sound/soc/soc-cache.c +1 -1
@@ -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);
 	}
Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
Applied
#2 lore raw
In reply to Dimitris Papastamos
Quoted 6 lines · Dimitris Papastamos

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.

Applied, thanks.