Commit e21a1c26 authored by Iuliana Prodan's avatar Iuliana Prodan Committed by Greg Kroah-Hartman

crypto: caam - free resources in case caam_rng registration failed

[ Upstream commit c59a1d41 ]

Check the return value of the hardware registration for caam_rng and free
resources in case of failure.

Fixes: e24f7c9e ("crypto: caam - hwrng support")
Signed-off-by: default avatarIuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: default avatarHoria Geanta <horia.geanta@nxp.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 88f089d7
...@@ -353,7 +353,10 @@ static int __init caam_rng_init(void) ...@@ -353,7 +353,10 @@ static int __init caam_rng_init(void)
goto free_rng_ctx; goto free_rng_ctx;
dev_info(dev, "registering rng-caam\n"); dev_info(dev, "registering rng-caam\n");
return hwrng_register(&caam_rng);
err = hwrng_register(&caam_rng);
if (!err)
return err;
free_rng_ctx: free_rng_ctx:
kfree(rng_ctx); kfree(rng_ctx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment