From: Marek Vasut Date: Thu, 24 Apr 2014 18:05:14 +0000 (+0200) Subject: crypto: caam - Implement fast-path for error codes with no handler X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=867e1ee395d845f49ae280c3d8f5271b214fa7e4;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git crypto: caam - Implement fast-path for error codes with no handler Implement fast-path error code printout for errors with no associated handler function. This reduces calls to this kmalloc() nonsense in SPRINTFCAT() already. Note that the format of output is compatible with the old code, even if -- exposed like this -- it looks a bit weird. Checkpatch complains on this one as well. Signed-off-by: Marek Vasut Cc: Herbert Xu Cc: Horia Geanta Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/caam/error.c b/drivers/crypto/caam/error.c index 3d7be4c05008..961331d1b6ab 100644 --- a/drivers/crypto/caam/error.c +++ b/drivers/crypto/caam/error.c @@ -265,10 +265,18 @@ void caam_jr_strstatus(struct device *jrdev, u32 status) }; u32 ssrc = status >> JRSTA_SSRC_SHIFT; + /* + * If there is no further error handling function, just + * print the error code, error string and exit. + */ + if (!status_src[ssrc].report_ssed) { + dev_err(jrdev, "%08x: %s: \n", status, status_src[ssrc].error); + return; + } + sprintf(outstr, "%s: ", status_src[ssrc].error); - if (status_src[ssrc].report_ssed) - status_src[ssrc].report_ssed(status, outstr); + status_src[ssrc].report_ssed(status, outstr); dev_err(jrdev, "%08x: %s\n", status, outstr); }