Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jia Jie Ho and committed by
Herbert Xu
25ca4a85 3d12d90e

+4 -6
+4 -6
drivers/crypto/starfive/jh7110-rsa.c
··· 537 537 { 538 538 struct starfive_cryp_ctx *ctx = akcipher_tfm_ctx(tfm); 539 539 540 + ctx->cryp = starfive_cryp_find_dev(ctx); 541 + if (!ctx->cryp) 542 + return -ENODEV; 543 + 540 544 ctx->akcipher_fbk = crypto_alloc_akcipher("rsa-generic", 0, 0); 541 545 if (IS_ERR(ctx->akcipher_fbk)) 542 546 return PTR_ERR(ctx->akcipher_fbk); 543 - 544 - ctx->cryp = starfive_cryp_find_dev(ctx); 545 - if (!ctx->cryp) { 546 - crypto_free_akcipher(ctx->akcipher_fbk); 547 - return -ENODEV; 548 - } 549 547 550 548 akcipher_set_reqsize(tfm, sizeof(struct starfive_cryp_request_ctx) + 551 549 sizeof(struct crypto_akcipher) + 32);