Skip to contentSkip to conversation

ASoC: sigmadsp: Fix missleading return value

PATCH In review [email protected] 2 participants 2 messages Feb 10, 2016

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

PATCH 1/1 ASoC: sigmadsp: Fix missleading return value

From: Pascal Huerst <[email protected]>

Forwarding the return value of i2c_master_send, leads to errors later on, since i2c_master_send returns the number of bytes transmittet. Check for ret < 0 instead and return 0 otherwise.

---
 sound/soc/codecs/sigmadsp-i2c.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/codecs/sigmadsp-i2c.c +4 -1
index 21ca3a5..d374c18 100644
@@ -31,7 +31,10 @@ static int sigmadsp_write_i2c(void *control_data,
 
 	kfree(buf);
 
-	return ret;
+	if (ret < 0)
+		return ret;
+
+	return 0;
 }
 
 static int sigmadsp_read_i2c(void *control_data,
Signature · 1 line
2.4.3
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · On 02/10/2016 03:59 PM, [email protected] wrote:

From: Pascal Huerst <[email protected]>

Forwarding the return value of i2c_master_send, leads to errors later on, since i2c_master_send returns the number of bytes transmittet. Check for ret < 0 instead and return 0 otherwise.

Quoted 21 lines
---
 sound/soc/codecs/sigmadsp-i2c.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/codecs/sigmadsp-i2c.c +4 -1
index 21ca3a5..d374c18 100644
@@ -31,7 +31,10 @@ static int sigmadsp_write_i2c(void *control_data,
 
 	kfree(buf);
 
-	return ret;
+	if (ret < 0)
+		return ret;
+
+	return 0;
 }
 
 static int sigmadsp_read_i2c(void *control_data,