commit: http://blackfin.uclinux.org/git/?p=linux-kernel;a=commitdiff;h=d9777f0c6bccbb6cf26db81cde4e93a57b2c2873
branch: http://blackfin.uclinux.org/git/?p=linux-kernel;a=shortlog;h=refs/heads/2011R1

Provide error messages when loading the firmware fails, so it is possible to
diagnose the reason why it failed.

Signed-off-by: Lars-Peter Clausen <[email protected]>
---
 sound/soc/codecs/sigma.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/sigma.c b/sound/soc/codecs/sigma.c
index 4e89c63..274e225 100644
--- a/sound/soc/codecs/sigma.c
+++ b/sound/soc/codecs/sigma.c
@@ -118,18 +118,25 @@ int process_sigma_firmware(struct i2c_client *client, const char *name)
 	ret = -EINVAL;
 
 	/* Reject too small or unreasonable large files */
-	if (fw->size < sizeof(*ssfw_head) || fw->size > 0x100000)
+	if (fw->size < sizeof(*ssfw_head) || fw->size > 0x100000) {
+		dev_err(&client->dev, "Failed to load firmware: Invalid size\n");
 		goto done;
+	}
 
 	ssfw_head = (void *)fw->data;
-	if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic)))
+	if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic))) {
+		dev_err(&client->dev, "Failed to load firmware: Invalid magic\n");
 		goto done;
+	}
 
 	crc = crc32(0, fw->data + sizeof(*ssfw_head),
 			fw->size - sizeof(*ssfw_head));
 	pr_debug("%s: crc=%x\n", __func__, crc);
-	if (crc != le32_to_cpu(ssfw_head->crc))
+	if (crc != le32_to_cpu(ssfw_head->crc)) {
+		dev_err(&client->dev, "Failed to load firmware: Wrong crc checksum:" \
+			" expected %x got %x\n", le32_to_cpu(ssfw_head->crc), crc);
 		goto done;
+	}
 
 	ssfw.pos = sizeof(*ssfw_head);
 
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to