summaryrefslogtreecommitdiff
path: root/drivers/crypto/caam
diff options
context:
space:
mode:
authorIuliana Prodan <iuliana.prodan@nxp.com>2019-07-31 16:08:12 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-27 16:46:42 +0300
commit5ea904f9954ee9072114a8d52c951b13bb8ed7bd (patch)
treef466922e6d33c5781afe4dd4e9f4755df1480aab /drivers/crypto/caam
parentf996f9ee615bebddcab67e4ebaeb5ce56956d256 (diff)
downloadlinux-5ea904f9954ee9072114a8d52c951b13bb8ed7bd.tar.xz
crypto: caam - free resources in case caam_rng registration failed
[ Upstream commit c59a1d41672a89b5cac49db1a472ff889e35a2d2 ] Check the return value of the hardware registration for caam_rng and free resources in case of failure. Fixes: e24f7c9e87d4 ("crypto: caam - hwrng support") Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com> Reviewed-by: Horia Geanta <horia.geanta@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/crypto/caam')
-rw-r--r--drivers/crypto/caam/caamrng.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c
index fde07d4ff019..ff6718a11e9e 100644
--- a/drivers/crypto/caam/caamrng.c
+++ b/drivers/crypto/caam/caamrng.c
@@ -353,7 +353,10 @@ static int __init caam_rng_init(void)
goto free_rng_ctx;
dev_info(dev, "registering rng-caam\n");
- return hwrng_register(&caam_rng);
+
+ err = hwrng_register(&caam_rng);
+ if (!err)
+ return err;
free_rng_ctx:
kfree(rng_ctx);