2010-11-23 06:09:07

by Axel Lin

[permalink] [raw]
Subject: [PATCH] ASoC: Do not update the cache if write to hardware failed

Signed-off-by: Axel Lin <[email protected]>
---
sound/soc/codecs/tpa6130a2.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
index bfef3da..2d64502 100644
--- a/sound/soc/codecs/tpa6130a2.c
+++ b/sound/soc/codecs/tpa6130a2.c
@@ -77,8 +77,10 @@ static int tpa6130a2_i2c_write(int reg, u8 value)

if (data->power_state) {
val = i2c_smbus_write_byte_data(tpa6130a2_client, reg, value);
- if (val < 0)
+ if (val < 0) {
dev_err(&tpa6130a2_client->dev, "Write failed\n");
+ return val;
+ }
}

/* Either powered on or off, we save the context */
--
1.7.2



2010-11-23 07:40:56

by Peter Ujfalusi

[permalink] [raw]
Subject: Re: [PATCH] ASoC: Do not update the cache if write to hardware failed

On Tuesday 23 November 2010 08:14:07 ext Axel Lin wrote:
> Signed-off-by: Axel Lin <[email protected]>
> ---
> sound/soc/codecs/tpa6130a2.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
> index bfef3da..2d64502 100644
> --- a/sound/soc/codecs/tpa6130a2.c
> +++ b/sound/soc/codecs/tpa6130a2.c
> @@ -77,8 +77,10 @@ static int tpa6130a2_i2c_write(int reg, u8 value)
>
> if (data->power_state) {
> val = i2c_smbus_write_byte_data(tpa6130a2_client, reg, value);
> - if (val < 0)
> + if (val < 0) {
> dev_err(&tpa6130a2_client->dev, "Write failed\n");
> + return val;
> + }
> }
>
> /* Either powered on or off, we save the context */

Nice catch, thank you!

CC-ing alsa-devel

Acked-by: Peter Ujfalusi <[email protected]>

2010-11-23 10:25:00

by Liam Girdwood

[permalink] [raw]
Subject: Re: [PATCH] ASoC: Do not update the cache if write to hardware failed

On Tue, 2010-11-23 at 14:14 +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <[email protected]>
> ---
> sound/soc/codecs/tpa6130a2.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
> index bfef3da..2d64502 100644
> --- a/sound/soc/codecs/tpa6130a2.c
> +++ b/sound/soc/codecs/tpa6130a2.c
> @@ -77,8 +77,10 @@ static int tpa6130a2_i2c_write(int reg, u8 value)
>
> if (data->power_state) {
> val = i2c_smbus_write_byte_data(tpa6130a2_client, reg, value);
> - if (val < 0)
> + if (val < 0) {
> dev_err(&tpa6130a2_client->dev, "Write failed\n");
> + return val;
> + }
> }
>
> /* Either powered on or off, we save the context */

Acked-by: Liam Girdwood <[email protected]>
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

2010-11-23 14:53:37

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] ASoC: Do not update the cache if write to hardware failed

On Tue, Nov 23, 2010 at 02:14:07PM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <[email protected]>

Applied, thanks.