Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: Return -1 instead of -EINVAL to ensure consistency
@ 2010-09-21 16:04 Dimitris Papastamos
  2010-09-22  8:54 ` Liam Girdwood
  2010-09-22 15:49 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Dimitris Papastamos @ 2010-09-21 16:04 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, patches

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(-)

diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 28bf1ff..6702a3d 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -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);
 	}
-- 
1.7.3

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

* Re: [PATCH] ASoC: Return -1 instead of -EINVAL to ensure consistency
  2010-09-21 16:04 [PATCH] ASoC: Return -1 instead of -EINVAL to ensure consistency Dimitris Papastamos
@ 2010-09-22  8:54 ` Liam Girdwood
  2010-09-22 15:49 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2010-09-22  8:54 UTC (permalink / raw)
  To: Dimitris Papastamos; +Cc: alsa-devel, Mark Brown, patches

On Tue, 2010-09-21 at 17:04 +0100, Dimitris Papastamos wrote:
> 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(-)
> 
> diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
> index 28bf1ff..6702a3d 100644
> --- a/sound/soc/soc-cache.c
> +++ b/sound/soc/soc-cache.c
> @@ -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);
>  	}

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: Return -1 instead of -EINVAL to ensure consistency
  2010-09-21 16:04 [PATCH] ASoC: Return -1 instead of -EINVAL to ensure consistency Dimitris Papastamos
  2010-09-22  8:54 ` Liam Girdwood
@ 2010-09-22 15:49 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2010-09-22 15:49 UTC (permalink / raw)
  To: Dimitris Papastamos; +Cc: alsa-devel, patches, Liam Girdwood

On Tue, Sep 21, 2010 at 05:04:07PM +0100, Dimitris Papastamos wrote:
> 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.

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

end of thread, other threads:[~2010-09-22 15:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-21 16:04 [PATCH] ASoC: Return -1 instead of -EINVAL to ensure consistency Dimitris Papastamos
2010-09-22  8:54 ` Liam Girdwood
2010-09-22 15:49 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox