From: Lars-Peter Clausen <lars@metafoo.de>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>,
Liam Girdwood <lrg@ti.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Mike Frysinger <vapier@gentoo.org>,
<linux-kernel@vger.kernel.org>, <alsa-devel@alsa-project.org>,
<drivers@analog.com>, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH v2 5/7] ASoC: SigmaDSP: Provide diagnostic error messages
Date: Mon, 28 Nov 2011 09:44:18 +0100 [thread overview]
Message-ID: <1322469860-8210-5-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1322469860-8210-1-git-send-email-lars@metafoo.de>
Provide some error messages when loading the firmware fails, so it is possible
to diagnose the reason for the failure.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
Changes since v1:
* Don't split error message string across multiple lines.
---
sound/soc/codecs/sigmadsp.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c
index acb97a9..c0ad885 100644
--- a/sound/soc/codecs/sigmadsp.c
+++ b/sound/soc/codecs/sigmadsp.c
@@ -124,18 +124,25 @@ int process_sigma_firmware(struct i2c_client *client, const char *name)
* purposes and having the limit makes it easier to avoid integer
* overflows later in the loading process.
*/
- if (fw->size < sizeof(*ssfw_head) || fw->size >= 0x4000000)
+ if (fw->size < sizeof(*ssfw_head) || fw->size >= 0x4000000) {
+ 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);
--
1.7.7.3
next prev parent reply other threads:[~2011-11-28 8:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-28 8:44 [PATCH v2 1/7] firmware: Sigma: Prevent out of bounds memory access Lars-Peter Clausen
2011-11-28 8:44 ` [PATCH v2 2/7] firmware: Sigma: Skip header during CRC generation Lars-Peter Clausen
2011-11-29 5:12 ` Mike Frysinger
2011-11-28 8:44 ` [PATCH v2 3/7] firmware: Sigma: Fix endianess issues Lars-Peter Clausen
2011-11-28 8:44 ` [PATCH v2 4/7] ASoC: Move SigmaDSP firmware loader to ASoC Lars-Peter Clausen
2011-11-28 8:44 ` Lars-Peter Clausen [this message]
2011-11-29 5:12 ` [PATCH v2 5/7] ASoC: SigmaDSP: Provide diagnostic error messages Mike Frysinger
2011-11-28 8:44 ` [PATCH v2 6/7] ASoC: SigmaDSP: Move private structs and functions to C file Lars-Peter Clausen
2011-11-28 8:44 ` [PATCH v2 7/7] ASoC: SigmaDSP: Add regmap support Lars-Peter Clausen
2011-11-29 5:17 ` Mike Frysinger
2011-11-29 5:12 ` [PATCH v2 1/7] firmware: Sigma: Prevent out of bounds memory access Mike Frysinger
2011-11-29 10:12 ` Mark Brown
2011-11-29 10:18 ` [alsa-devel] " Lars-Peter Clausen
2011-11-29 12:02 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1322469860-8210-5-git-send-email-lars@metafoo.de \
--to=lars@metafoo.de \
--cc=akpm@linux-foundation.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=drivers@analog.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
--cc=vapier@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome