crypto: amlogic - ensure error variable err is set before returning it
authorColin Ian King <colin.king@canonical.com>
Tue, 29 Oct 2019 11:32:30 +0000 (11:32 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 8 Nov 2019 15:00:46 +0000 (23:00 +0800)
Currently when the call to crypto_engine_alloc_init fails the error
return path returns an uninitialized value in the variable err. Fix
this by setting err to -ENOMEM.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: 48fe583fe541 ("crypto: amlogic - Add crypto accelerator for amlogic GXL")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/amlogic/amlogic-gxl-core.c

index db5b421e88d8c102df78079164aa6501acd7c3f8..fa05fce1c0dec9ea3afadaf58236bcb78f150574 100644 (file)
@@ -162,6 +162,7 @@ static int meson_allocate_chanlist(struct meson_dev *mc)
                if (!mc->chanlist[i].engine) {
                        dev_err(mc->dev, "Cannot allocate engine\n");
                        i--;
+                       err = -ENOMEM;
                        goto error_engine;
                }
                err = crypto_engine_start(mc->chanlist[i].engine);