crypto: starfive: jh7110-rsa: Fix the wrong error handling
authorJaehoon Chung <jh80.chung@samsung.com>
Mon, 29 Jan 2024 03:47:03 +0000 (12:47 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 19 Feb 2024 00:14:01 +0000 (09:14 +0900)
Fix the wrong error handling.
Even though error is not occurred, rsa_data should be freed.

Change-Id: I40c5cc8bfb7b06e34524e37fc440e515204adf1e
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
drivers/crypto/starfive/jh7110-rsa.c

index cf8bda7f0855d911bbc46734fbf69b084c443bfa..19da8b8f17b74a8a09998a22c12ed9419197a405 100644 (file)
@@ -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);