summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2014-04-24 18:05:19 (GMT)
committerMatthew Weigel <Matthew.Weigel@freescale.com>2014-12-11 18:41:27 (GMT)
commita50dcd896041fae96e32480e8589deaba30bbc2a (patch)
tree4013a9541550739c4fa89dc71b10019422becd01 /drivers/crypto
parent03e1d1dab7ef57095640195b5782990c6a6d0247 (diff)
downloadlinux-fsl-qoriq-a50dcd896041fae96e32480e8589deaba30bbc2a.tar.xz
crypto: caam - Clean up report_deco_status()
Clean this function up and rework it into sensible shape. This function now contains one single dev_err() instead of the previous insanity full of memory allocation, chaotic string handling and use of SPRINTFCAT(). Signed-off-by: Marek Vasut <marex@denx.de> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Horia Geanta <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 4f0fa52a5d89d763423cb9b428e988ea824fd95a)
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/caam/error.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/drivers/crypto/caam/error.c b/drivers/crypto/caam/error.c
index 91cc5fc..66a7461 100644
--- a/drivers/crypto/caam/error.c
+++ b/drivers/crypto/caam/error.c
@@ -218,35 +218,30 @@ static void report_jump_status(struct device *jrdev, u32 status,
static void report_deco_status(struct device *jrdev, u32 status,
const char *error, char *__outstr)
{
- char outstr[CAAM_ERROR_STR_MAX];
-
- u8 desc_error = status & JRSTA_DECOERR_ERROR_MASK;
+ u8 err_id = status & JRSTA_DECOERR_ERROR_MASK;
u8 idx = (status & JRSTA_DECOERR_INDEX_MASK) >>
JRSTA_DECOERR_INDEX_SHIFT;
-
+ char *idx_str;
+ char *err_str = "unidentified error value 0x";
+ char err_err_code[3] = { 0 };
int i;
- sprintf(outstr, "%s: ", error);
if (status & JRSTA_DECOERR_JUMP)
- strcat(outstr, "jump tgt desc idx ");
+ idx_str = "jump tgt desc idx";
else
- strcat(outstr, "desc idx ");
-
- SPRINTFCAT(outstr, "%d: ", idx, sizeof("255"));
+ idx_str = "desc idx";
for (i = 0; i < ARRAY_SIZE(desc_error_list); i++)
- if (desc_error_list[i].value == desc_error)
+ if (desc_error_list[i].value == err_id)
break;
- if (i != ARRAY_SIZE(desc_error_list) && desc_error_list[i].error_text) {
- SPRINTFCAT(outstr, "%s", desc_error_list[i].error_text,
- strlen(desc_error_list[i].error_text));
- } else {
- SPRINTFCAT(outstr, "unidentified error value 0x%02x",
- desc_error, sizeof("ff"));
- }
+ if (i != ARRAY_SIZE(desc_error_list) && desc_error_list[i].error_text)
+ err_str = desc_error_list[i].error_text;
+ else
+ snprintf(err_err_code, sizeof(err_err_code), "%02x", err_id);
- dev_err(jrdev, "%08x: %s\n", status, outstr);
+ dev_err(jrdev, "%08x: %s: %s %d: %s%s\n",
+ status, error, idx_str, idx, err_str, err_err_code);
}
static void report_jr_status(struct device *jrdev, u32 status,