Skip to content

Commit

Permalink
crypto: starfive - Skip unneeded fallback allocation
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
jiajieho authored and herbertx committed May 10, 2024
1 parent 3d12d90 commit 25ca4a8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions drivers/crypto/starfive/jh7110-rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 25ca4a8

Please sign in to comment.