Skip to contentSkip to conversation

ASoC: Do not update the cache if write to hardware failed

PATCH Applied Axel Lin 4 participants 4 messages Nov 23, 2010

Subsystems (3)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 ASoC: Do not update the cache if write to hardware failed

---
 sound/soc/codecs/tpa6130a2.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
sound/soc/codecs/tpa6130a2.c +3 -1
index bfef3da..2d64502 100644
@@ -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 */
Signature · 1 line
1.7.2
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · On Tuesday 23 November 2010 08:14:07 ext Axel Lin wrote:
---
 sound/soc/codecs/tpa6130a2.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
sound/soc/codecs/tpa6130a2.c +0 -0
index bfef3da..2d64502 100644
@@ -77,8 +77,10 @@ static int tpa6130a2_i2c_write(int reg, u8 value)
 

sound/soc/codecs/tpa6130a2.c static int tpa6130a2_i2c_write(int reg, u8 value) · line 86

Quoted 10 lines
sound/soc/codecs/tpa6130a2.c +3 -1
 	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 on v1 1/1
#2 lore raw
In reply to Axel Lin
Quoted 11 lines · Axel Lin
---
 sound/soc/codecs/tpa6130a2.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
sound/soc/codecs/tpa6130a2.c +0 -0
index bfef3da..2d64502 100644
@@ -77,8 +77,10 @@ static int tpa6130a2_i2c_write(int reg, u8 value)
 

sound/soc/codecs/tpa6130a2.c static int tpa6130a2_i2c_write(int reg, u8 value) · line 86

Quoted 10 lines
sound/soc/codecs/tpa6130a2.c +3 -1
 	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 */
Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk