Commit 1c269c8a authored by Iuliana Prodan's avatar Iuliana Prodan Committed by Kleber Sacilotto de Souza

crypto: caam - free resources in case caam_rng registration failed

BugLink: https://bugs.launchpad.net/bugs/1864773

[ 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>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 16c64afd
......@@ -361,7 +361,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);
......
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