ASoC: core - make IO calls return a valid errno on failure.
PATCH 1/1 ASoC: core - make IO calls return a valid errno on failure.
IO call failures should return an errno instead of -1
--- sound/soc/soc-core.c | 4 ++-- sound/soc/soc-dapm.c | 4 ++-- sound/soc/soc-io.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-)
sound/soc/soc-core.c +2 -2
@@ -1661,7 +1661,7 @@ int snd_soc_platform_read(struct snd_soc_platform *platform,if (!platform->driver->read) {dev_err (platform->dev,"platform has no read back\n" ); -return -1 ; +return -EINVAL ; } ret = platform->driver->read (platform, reg);
@@ -1677,7 +1677,7 @@ int snd_soc_platform_write(struct snd_soc_platform *platform, {if (!platform->driver->write) {dev_err (platform->dev,"platform has no write back\n" ); -return -1 ; +return -EINVAL ; }dev_dbg (platform->dev,"write %x = %x\n" , reg, val);
sound/soc/soc-dapm.c +2 -2
@@ -132,7 +132,7 @@ static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg)return snd_soc_platform_read (w->platform, reg);dev_err (w->dapm->dev,"no valid widget read method\n" ); -return -1 ; +return -EINVAL ; }static int soc_widget_write (struct snd_soc_dapm_widget *w,int reg,int val)
@@ -143,7 +143,7 @@ static int soc_widget_write(struct snd_soc_dapm_widget *w, int reg, int val)return snd_soc_platform_write (w->platform, reg, val);dev_err (w->dapm->dev,"no valid widget write method\n" ); -return -1 ; +return -EINVAL ; } static int soc_widget_update_bits(struct snd_soc_dapm_widget *w,
sound/soc/soc-io.c +3 -3
@@ -41,7 +41,7 @@ static int do_hw_write(struct snd_soc_codec *codec, unsigned int reg, !codec->cache_bypass) { ret =snd_soc_cache_write (codec, reg, value);if (ret <0 ) -return -1 ; +return ret; }if (codec->cache_only) {
@@ -67,7 +67,7 @@ static unsigned int hw_read(struct snd_soc_codec *codec, unsigned int reg) snd_soc_codec_volatile_register(codec, reg) || codec->cache_bypass) {if (codec->cache_only) -return -1 ; +return -EINVAL ;BUG_ON (!codec->hw_read);return codec->hw_read (codec, reg);
@@ -75,7 +75,7 @@ static unsigned int hw_read(struct snd_soc_codec *codec, unsigned int reg) ret =snd_soc_cache_read (codec, reg, &val);if (ret <0 ) -return -1 ; +return ret;return val; }
Signature · 1 line
1.7.4.1
Quoted 1 line · Liam Girdwood
IO call failures should return an errno instead of -1
Yeah, it really should but it's kind of tricky for the reads as we're returning errors in band and we could have 32 bit registers (I'm guessing the platform versions already do) so we lose. :/ Not sure what the best thing to do there is, changing to return the errors out of band for reads is more painful than I care to contemplate.
Quoted 8 lines · Mark Brown
Quoted 1 line · Liam Girdwood
IO call failures should return an errno instead of -1
Yeah, it really should but it's kind of tricky for the reads as we're returning errors in band and we could have 32 bit registers (I'm guessing the platform versions already do) so we lose. :/ Not sure what the best thing to do there is, changing to return the errors out of band for reads is more painful than I care to contemplate.
Oh, I agree it would be painful for a rework here. But why did you suggest this sort of update in a previous patch comment ? (Unless I misunderstood).
Liam
Quoted 11 lines · Liam Girdwood
Quoted 5 lines · Mark Brown
Yeah, it really should but it's kind of tricky for the reads as we're returning errors in band and we could have 32 bit registers (I'm guessing the platform versions already do) so we lose. :/ Not sure what the best thing to do there is, changing to return the errors out of band for reads is more painful than I care to contemplate.
Oh, I agree it would be painful for a rework here. But why did you suggest this sort of update in a previous patch comment ? (Unless I misunderstood).
Dunno the specific posting but there's two things I can think of:
- This isn't an issue for writes so they can and should pass back error codes, it's only reads that have trouble.
- If I see people converting an error code into -EINVAL or something I tend to complain about that.