diff options
-rw-r--r-- | drivers/crypto/caam/caamalg.c | 42 | ||||
-rw-r--r-- | drivers/crypto/caam/caamalg_qi.c | 12 | ||||
-rw-r--r-- | drivers/crypto/caam/caamhash.c | 28 | ||||
-rw-r--r-- | drivers/crypto/caam/caampkc.c | 18 | ||||
-rw-r--r-- | drivers/crypto/caam/caamrng.c | 7 | ||||
-rw-r--r-- | drivers/crypto/caam/error.c | 5 | ||||
-rw-r--r-- | drivers/crypto/caam/error.h | 2 | ||||
-rw-r--r-- | drivers/crypto/caam/key_gen.c | 7 |
8 files changed, 37 insertions, 84 deletions
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index c9ca243..918fd72 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c @@ -1609,11 +1609,8 @@ static void aead_encrypt_done(struct device *jrdev, u32 *desc, u32 err, edesc = (struct aead_edesc *)((char *)desc - offsetof(struct aead_edesc, hw_desc)); - if (err) { - char tmp[CAAM_ERROR_STR_MAX]; - - dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); - } + if (err) + caam_jr_strstatus(jrdev, err); aead_unmap(jrdev, edesc, req); @@ -1660,11 +1657,8 @@ static void aead_decrypt_done(struct device *jrdev, u32 *desc, u32 err, req->cryptlen - ctx->authsize, 1); #endif - if (err) { - char tmp[CAAM_ERROR_STR_MAX]; - - dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); - } + if (err) + caam_jr_strstatus(jrdev, err); aead_unmap(jrdev, edesc, req); @@ -1707,11 +1701,8 @@ static void tls_encrypt_done(struct device *jrdev, u32 *desc, u32 err, edesc = (struct aead_edesc *)((char *)desc - offsetof(struct aead_edesc, hw_desc)); - if (err) { - char tmp[CAAM_ERROR_STR_MAX]; - - dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); - } + if (err) + caam_jr_strstatus(jrdev, err); aead_unmap(jrdev, edesc, req); @@ -1752,11 +1743,8 @@ static void tls_decrypt_done(struct device *jrdev, u32 *desc, u32 err, req->cryptlen, 1); #endif - if (err) { - char tmp[CAAM_ERROR_STR_MAX]; - - dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); - } + if (err) + caam_jr_strstatus(jrdev, err); aead_unmap(jrdev, edesc, req); @@ -1805,11 +1793,8 @@ static void ablkcipher_encrypt_done(struct device *jrdev, u32 *desc, u32 err, edesc = (struct ablkcipher_edesc *)((char *)desc - offsetof(struct ablkcipher_edesc, hw_desc)); - if (err) { - char tmp[CAAM_ERROR_STR_MAX]; - - dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); - } + if (err) + caam_jr_strstatus(jrdev, err); #ifdef DEBUG print_hex_dump(KERN_ERR, "dstiv @"__stringify(__LINE__)": ", @@ -1840,11 +1825,8 @@ static void ablkcipher_decrypt_done(struct device *jrdev, u32 *desc, u32 err, edesc = (struct ablkcipher_edesc *)((char *)desc - offsetof(struct ablkcipher_edesc, hw_desc)); - if (err) { - char tmp[CAAM_ERROR_STR_MAX]; - - dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); - } + if (err) + caam_jr_strstatus(jrdev, err); #ifdef DEBUG print_hex_dump(KERN_ERR, "dstiv @"__stringify(__LINE__)": ", diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c index aa0423a..f861565 100644 --- a/drivers/crypto/caam/caamalg_qi.c +++ b/drivers/crypto/caam/caamalg_qi.c @@ -995,9 +995,7 @@ static inline void aead_done(struct caam_drv_req *drv_req, u32 status) qidev = caam_ctx->qidev; if (status) { - char tmp[CAAM_ERROR_STR_MAX]; - dev_err(qidev, "Rsp status: %#x: %s\n", - status, caam_jr_strstatus(tmp, status)); + caam_jr_strstatus(qidev, status); ecode = -EIO; } @@ -1021,9 +1019,7 @@ static inline void tls_encrypt_done(struct caam_drv_req *drv_req, u32 status) qidev = caam_ctx->qidev; if (status) { - char tmp[CAAM_ERROR_STR_MAX]; - dev_err(qidev, "Rsp status: %#x: %s\n", - status, caam_jr_strstatus(tmp, status)); + caam_jr_strstatus(qidev, status); ecode = -EIO; } @@ -1050,9 +1046,7 @@ static inline void tls_decrypt_done(struct caam_drv_req *drv_req, u32 status) qidev = caam_ctx->qidev; if (status) { - char tmp[CAAM_ERROR_STR_MAX]; - dev_err(qidev, "Rsp status: %#x: %s\n", - status, caam_jr_strstatus(tmp, status)); + caam_jr_strstatus(qidev, status); ecode = -EIO; } diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index 7728119..d86a515 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c @@ -643,11 +643,8 @@ static void ahash_done(struct device *jrdev, u32 *desc, u32 err, edesc = (struct ahash_edesc *)((char *)desc - offsetof(struct ahash_edesc, hw_desc)); - if (err) { - char tmp[CAAM_ERROR_STR_MAX]; - - dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); - } + if (err) + caam_jr_strstatus(jrdev, err); ahash_unmap(jrdev, edesc, req, digestsize); kfree(edesc); @@ -681,11 +678,8 @@ static void ahash_done_bi(struct device *jrdev, u32 *desc, u32 err, edesc = (struct ahash_edesc *)((char *)desc - offsetof(struct ahash_edesc, hw_desc)); - if (err) { - char tmp[CAAM_ERROR_STR_MAX]; - - dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); - } + if (err) + caam_jr_strstatus(jrdev, err); ahash_unmap_ctx(jrdev, edesc, req, ctx->ctx_len, DMA_BIDIRECTIONAL); kfree(edesc); @@ -719,11 +713,8 @@ static void ahash_done_ctx_src(struct device *jrdev, u32 *desc, u32 err, edesc = (struct ahash_edesc *)((char *)desc - offsetof(struct ahash_edesc, hw_desc)); - if (err) { - char tmp[CAAM_ERROR_STR_MAX]; - - dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); - } + if (err) + caam_jr_strstatus(jrdev, err); ahash_unmap_ctx(jrdev, edesc, req, digestsize, DMA_TO_DEVICE); kfree(edesc); @@ -757,11 +748,8 @@ static void ahash_done_ctx_dst(struct device *jrdev, u32 *desc, u32 err, edesc = (struct ahash_edesc *)((char *)desc - offsetof(struct ahash_edesc, hw_desc)); - if (err) { - char tmp[CAAM_ERROR_STR_MAX]; - - dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); - } + if (err) + caam_jr_strstatus(jrdev, err); ahash_unmap_ctx(jrdev, edesc, req, ctx->ctx_len, DMA_FROM_DEVICE); kfree(edesc); diff --git a/drivers/crypto/caam/caampkc.c b/drivers/crypto/caam/caampkc.c index 173fc41..f98abfb 100644 --- a/drivers/crypto/caam/caampkc.c +++ b/drivers/crypto/caam/caampkc.c @@ -143,10 +143,8 @@ static void rsa_op_done(struct device *dev, u32 *desc, u32 err, void *context) edesc = (struct rsa_edesc *)((char *)desc - offsetof(struct rsa_edesc, hw_desc)); - if (err) { - char tmp[CAAM_ERROR_STR_MAX]; - dev_err(dev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); - } + if (err) + caam_jr_strstatus(dev, err); rsa_unmap(dev, edesc, req); kfree(edesc); @@ -269,10 +267,8 @@ static void dsa_op_done(struct device *dev, u32 *desc, u32 err, void *context) edesc = (struct dsa_edesc_s *)((char *)desc - offsetof(struct dsa_edesc_s, hw_desc)); - if (err) { - char tmp[CAAM_ERROR_STR_MAX]; - dev_err(dev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); - } + if (err) + caam_jr_strstatus(dev, err); dsa_unmap(dev, edesc, req); kfree(edesc); @@ -1225,10 +1221,8 @@ static void dh_op_done(struct device *dev, u32 *desc, u32 err, void *context) edesc = (struct dh_edesc_s *)((char *)desc - offsetof(struct dh_edesc_s, hw_desc)); - if (err) { - char tmp[CAAM_ERROR_STR_MAX]; - dev_err(dev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); - } + if (err) + caam_jr_strstatus(dev, err); dh_unmap(dev, edesc, req); kfree(edesc); diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c index fcafd65..253a5b1 100644 --- a/drivers/crypto/caam/caamrng.c +++ b/drivers/crypto/caam/caamrng.c @@ -103,11 +103,8 @@ static void rng_done(struct device *jrdev, u32 *desc, u32 err, void *context) bd = (struct buf_data *)((char *)desc - offsetof(struct buf_data, hw_desc)); - if (err) { - char tmp[CAAM_ERROR_STR_MAX]; - - dev_err(jrdev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); - } + if (err) + caam_jr_strstatus(jrdev, err); atomic_set(&bd->empty, BUF_NOT_EMPTY); complete(&bd->filled); diff --git a/drivers/crypto/caam/error.c b/drivers/crypto/caam/error.c index 9f25f52..ba426d9 100644 --- a/drivers/crypto/caam/error.c +++ b/drivers/crypto/caam/error.c @@ -243,8 +243,9 @@ static void report_cond_code_status(u32 status, char *outstr) SPRINTFCAT(outstr, "%s() not implemented", __func__, sizeof(__func__)); } -char *caam_jr_strstatus(char *outstr, u32 status) +void caam_jr_strstatus(struct device *jrdev, u32 status) { + char outstr[CAAM_ERROR_STR_MAX]; static const struct stat_src { void (*report_ssed)(u32 status, char *outstr); char *error; @@ -265,6 +266,6 @@ char *caam_jr_strstatus(char *outstr, u32 status) if (status_src[ssrc].report_ssed) status_src[ssrc].report_ssed(status, outstr); - return outstr; + dev_err(jrdev, "%08x: %s\n", status, outstr); } EXPORT_SYMBOL(caam_jr_strstatus); diff --git a/drivers/crypto/caam/error.h b/drivers/crypto/caam/error.h index 02c7baa..b6350b0 100644 --- a/drivers/crypto/caam/error.h +++ b/drivers/crypto/caam/error.h @@ -7,5 +7,5 @@ #ifndef CAAM_ERROR_H #define CAAM_ERROR_H #define CAAM_ERROR_STR_MAX 302 -extern char *caam_jr_strstatus(char *outstr, u32 status); +void caam_jr_strstatus(struct device *jrdev, u32 status); #endif /* CAAM_ERROR_H */ diff --git a/drivers/crypto/caam/key_gen.c b/drivers/crypto/caam/key_gen.c index ea2e406..871703c 100644 --- a/drivers/crypto/caam/key_gen.c +++ b/drivers/crypto/caam/key_gen.c @@ -19,11 +19,8 @@ void split_key_done(struct device *dev, u32 *desc, u32 err, dev_err(dev, "%s %d: err 0x%x\n", __func__, __LINE__, err); #endif - if (err) { - char tmp[CAAM_ERROR_STR_MAX]; - - dev_err(dev, "%08x: %s\n", err, caam_jr_strstatus(tmp, err)); - } + if (err) + caam_jr_strstatus(dev, err); res->err = err; |