Skip to content

Commit

Permalink
crypto: caam - free resources in case caam_rng registration failed
Browse files Browse the repository at this point in the history
Check the return value of the hardware registration for caam_rng and free
resources in case of failure.

Fixes: e24f7c9 ("crypto: caam - hwrng support")
Signed-off-by: Iuliana Prodan <[email protected]>
Reviewed-by: Horia Geanta <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
iuliana-prodan authored and herbertx committed Aug 9, 2019
1 parent e9b4913 commit c59a1d4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/crypto/caam/caamrng.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c59a1d4

Please sign in to comment.