Skip to content

Commit 25ca4a8

Browse files
jiajiehoherbertx
authored andcommitted
crypto: starfive - Skip unneeded fallback allocation
Skip sw fallback allocation if RSA module failed to get device handle. Signed-off-by: Jia Jie Ho <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 3d12d90 commit 25ca4a8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/crypto/starfive/jh7110-rsa.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -537,16 +537,14 @@ static int starfive_rsa_init_tfm(struct crypto_akcipher *tfm)
537537
{
538538
struct starfive_cryp_ctx *ctx = akcipher_tfm_ctx(tfm);
539539

540+
ctx->cryp = starfive_cryp_find_dev(ctx);
541+
if (!ctx->cryp)
542+
return -ENODEV;
543+
540544
ctx->akcipher_fbk = crypto_alloc_akcipher("rsa-generic", 0, 0);
541545
if (IS_ERR(ctx->akcipher_fbk))
542546
return PTR_ERR(ctx->akcipher_fbk);
543547

544-
ctx->cryp = starfive_cryp_find_dev(ctx);
545-
if (!ctx->cryp) {
546-
crypto_free_akcipher(ctx->akcipher_fbk);
547-
return -ENODEV;
548-
}
549-
550548
akcipher_set_reqsize(tfm, sizeof(struct starfive_cryp_request_ctx) +
551549
sizeof(struct crypto_akcipher) + 32);
552550

0 commit comments

Comments
 (0)