lkml.org 
[lkml]   [2019]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v2 11/14] crypto: caam - free resources in case caam_rng registration failed
    Date
    Check the return value of the hardware registration for caam_rng and free
    resources in case of failure.

    Fixes: 6e4e603a9 ("crypto: caam - Dynamic memory allocation for caam_rng_ctx object")
    Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
    ---
    drivers/crypto/caam/caamrng.c | 5 ++++-
    1 file changed, 4 insertions(+), 1 deletion(-)

    diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c
    index 561bcb5..54c32d5 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);
    --
    2.1.0
    \
     
     \ /
      Last update: 2019-07-19 01:59    [W:2.719 / U:1.272 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site