Skip to contentSkip to conversation

ASoC: sigmadsp: Add check for return value of i2c_master_send

PATCH In review [email protected] 2 participants 2 messages Nov 26, 2015

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

PATCH 1/1 ASoC: sigmadsp: Add check for return value of i2c_master_send

From: Pascal Huerst <[email protected]>

i2c_master_send returns the number of bytes transmitted, which leads to an error in the firmware download function. Check for the return value and only return it directly, if it is an actual error number.

---
 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,

--
2.4.3