diff mbox

ASoC: sigmadsp: Add check for return value of i2c_master_send

Message ID 1448542815-14197-1-git-send-email-pascal.huerst@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Pascal Huerst Nov. 26, 2015, 1 p.m. UTC
From: Pascal Huerst <pascal.huerst@gmail.com>

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.

Signed-off-by: Pascal Huerst <pascal.huerst@gmail.com>
---
 sound/soc/codecs/sigmadsp-i2c.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--
2.4.3

Comments

Lars-Peter Clausen Nov. 26, 2015, 1:04 p.m. UTC | #1
On 11/26/2015 02:00 PM, pascal.huerst@gmail.com wrote:
> From: Pascal Huerst <pascal.huerst@gmail.com>
> 
> 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.
> 
> Signed-off-by: Pascal Huerst <pascal.huerst@gmail.com>

Acked-by: Lars-Peter Clausen <lars@metafoo.de>

Thanks.
diff mbox

Patch

diff --git a/sound/soc/codecs/sigmadsp-i2c.c b/sound/soc/codecs/sigmadsp-i2c.c
index 21ca3a5..d374c18 100644
--- a/sound/soc/codecs/sigmadsp-i2c.c
+++ b/sound/soc/codecs/sigmadsp-i2c.c
@@ -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,