From: Jaehoon Chung Date: Mon, 29 Jan 2024 03:47:03 +0000 (+0900) Subject: crypto: starfive: jh7110-rsa: Fix the wrong error handling X-Git-Tag: accepted/tizen/unified/x/20240220.145856~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6400a4433bd5d1b6fb3fb97d351d6d6670df7f0f;p=platform%2Fkernel%2Flinux-starfive.git 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 --- 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);