aboutsummaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorGravatar Jia Jie Ho <jiajie.ho@starfivetech.com> 2024-04-29 14:06:38 +0800
committerGravatar Herbert Xu <herbert@gondor.apana.org.au> 2024-05-10 17:15:24 +0800
commit25ca4a85e943d73582f3e576f0f829329568d0a3 (patch)
treeaed547c4509a556df098f9afeca276d05439dcd7 /drivers/crypto
parentcrypto: starfive - Skip dma setup for zeroed message (diff)
downloadlinux-25ca4a85e943d73582f3e576f0f829329568d0a3.tar.gz
linux-25ca4a85e943d73582f3e576f0f829329568d0a3.tar.bz2
linux-25ca4a85e943d73582f3e576f0f829329568d0a3.zip
crypto: starfive - Skip unneeded fallback allocation
Skip sw fallback allocation if RSA module failed to get device handle. Signed-off-by: Jia Jie Ho <jiajie.ho@starfivetech.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/starfive/jh7110-rsa.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/crypto/starfive/jh7110-rsa.c b/drivers/crypto/starfive/jh7110-rsa.c
index e642e948d747..4d7eb3d1e764 100644
--- a/drivers/crypto/starfive/jh7110-rsa.c
+++ b/drivers/crypto/starfive/jh7110-rsa.c
@@ -537,16 +537,14 @@ static int starfive_rsa_init_tfm(struct crypto_akcipher *tfm)
{
struct starfive_cryp_ctx *ctx = akcipher_tfm_ctx(tfm);
+ ctx->cryp = starfive_cryp_find_dev(ctx);
+ if (!ctx->cryp)
+ return -ENODEV;
+
ctx->akcipher_fbk = crypto_alloc_akcipher("rsa-generic", 0, 0);
if (IS_ERR(ctx->akcipher_fbk))
return PTR_ERR(ctx->akcipher_fbk);
- ctx->cryp = starfive_cryp_find_dev(ctx);
- if (!ctx->cryp) {
- crypto_free_akcipher(ctx->akcipher_fbk);
- return -ENODEV;
- }
-
akcipher_set_reqsize(tfm, sizeof(struct starfive_cryp_request_ctx) +
sizeof(struct crypto_akcipher) + 32);