From 6400a4433bd5d1b6fb3fb97d351d6d6670df7f0f Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Mon, 29 Jan 2024 12:47:03 +0900 Subject: [PATCH] crypto: starfive: jh7110-rsa: Fix the wrong error handling Fix the wrong error handling. Even though error is not occurred, rsa_data should be freed. Change-Id: I40c5cc8bfb7b06e34524e37fc440e515204adf1e Signed-off-by: Jaehoon Chung --- drivers/crypto/starfive/jh7110-rsa.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/crypto/starfive/jh7110-rsa.c b/drivers/crypto/starfive/jh7110-rsa.c index cf8bda7f0855..19da8b8f17b7 100644 --- a/drivers/crypto/starfive/jh7110-rsa.c +++ b/drivers/crypto/starfive/jh7110-rsa.c @@ -271,6 +271,9 @@ static int starfive_rsa_enc_core(struct starfive_cryp_ctx *ctx, int enc) sg_copy_buffer(rctx->out_sg, sg_nents(rctx->out_sg), rctx->rsa_data, key->key_sz, 0, 0); + writel(STARFIVE_RSA_RESET, cryp->base + STARFIVE_PKA_CACR_OFFSET); + return ret; + err_rsa_crypt: writel(STARFIVE_RSA_RESET, cryp->base + STARFIVE_PKA_CACR_OFFSET); kfree(rctx->rsa_data); -- 2.34.1