summaryrefslogtreecommitdiff
path: root/drivers/crypto/caam/caamalg.c
diff options
context:
space:
mode:
authorIuliana Prodan <iuliana.prodan@nxp.com>2020-02-12 20:55:20 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2020-02-22 04:25:47 +0300
commit4d370a1036958d7df9f1492c345b4984a4eba7f6 (patch)
tree77113940ba078bb828036aec4d3a00f321ac81ab /drivers/crypto/caam/caamalg.c
parentd53e44fe980ba7325ac60f85312c9facf78fbba1 (diff)
downloadlinux-4d370a1036958d7df9f1492c345b4984a4eba7f6.tar.xz
crypto: caam - change return code in caam_jr_enqueue function
Based on commit 6b80ea389a0b ("crypto: change transient busy return code to -ENOSPC"), change the return code of caam_jr_enqueue function to -EINPROGRESS, in case of success, -ENOSPC in case the CAAM is busy (has no space left in job ring queue), -EIO if it cannot map the caller's descriptor. Update, also, the cases for resource-freeing for each algorithm type. This is done for later use, on backlogging support in CAAM. Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com> Reviewed-by: Horia Geanta <horia.geanta@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/caam/caamalg.c')
-rw-r--r--drivers/crypto/caam/caamalg.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index 30fca375b9b4..c1dd8859e024 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -1398,9 +1398,7 @@ static inline int chachapoly_crypt(struct aead_request *req, bool encrypt)
1);
ret = caam_jr_enqueue(jrdev, desc, aead_crypt_done, req);
- if (!ret) {
- ret = -EINPROGRESS;
- } else {
+ if (ret != -EINPROGRESS) {
aead_unmap(jrdev, edesc, req);
kfree(edesc);
}
@@ -1443,9 +1441,7 @@ static inline int aead_crypt(struct aead_request *req, bool encrypt)
desc = edesc->hw_desc;
ret = caam_jr_enqueue(jrdev, desc, aead_crypt_done, req);
- if (!ret) {
- ret = -EINPROGRESS;
- } else {
+ if (ret != -EINPROGRESS) {
aead_unmap(jrdev, edesc, req);
kfree(edesc);
}
@@ -1488,9 +1484,7 @@ static inline int gcm_crypt(struct aead_request *req, bool encrypt)
desc = edesc->hw_desc;
ret = caam_jr_enqueue(jrdev, desc, aead_crypt_done, req);
- if (!ret) {
- ret = -EINPROGRESS;
- } else {
+ if (ret != -EINPROGRESS) {
aead_unmap(jrdev, edesc, req);
kfree(edesc);
}
@@ -1706,9 +1700,7 @@ static inline int skcipher_crypt(struct skcipher_request *req, bool encrypt)
desc = edesc->hw_desc;
ret = caam_jr_enqueue(jrdev, desc, skcipher_crypt_done, req);
- if (!ret) {
- ret = -EINPROGRESS;
- } else {
+ if (ret != -EINPROGRESS) {
skcipher_unmap(jrdev, edesc, req);
kfree(edesc);
}