diff options
author | Iuliana Prodan <iuliana.prodan@nxp.com> | 2019-07-31 16:08:12 +0300 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2019-08-09 15:11:50 +1000 |
commit | c59a1d41672a89b5cac49db1a472ff889e35a2d2 (patch) | |
tree | 5b4b6722b254f2b9a04abec90a17fa53f7d6e242 /drivers/crypto | |
parent | e9b4913a5f944b23d6109c44b6f3fc6e092e30ce (diff) | |
download | linux-c59a1d41672a89b5cac49db1a472ff889e35a2d2.tar.bz2 |
crypto: caam - free resources in case caam_rng registration failed
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>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/caam/caamrng.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c index 561bcb535184..54c32d53760c 100644 --- a/drivers/crypto/caam/caamrng.c +++ b/drivers/crypto/caam/caamrng.c @@ -333,7 +333,10 @@ int caam_rng_init(struct device *ctrldev) 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); |