From 5371b7700ab493846a230ae5ed553dc211452db3 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Tue, 29 Oct 2019 11:32:30 +0000 Subject: [PATCH] crypto: amlogic - ensure error variable err is set before returning it 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: 0e9a1b234cc7 ("crypto: amlogic - Add crypto accelerator for amlogic GXL") Signed-off-by: Colin Ian King Acked-by: Corentin Labbe Signed-off-by: Herbert Xu --- drivers/crypto/amlogic/amlogic-gxl-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/crypto/amlogic/amlogic-gxl-core.c b/drivers/crypto/amlogic/amlogic-gxl-core.c index db5b421e88d8c..fa05fce1c0dec 100644 --- a/drivers/crypto/amlogic/amlogic-gxl-core.c +++ b/drivers/crypto/amlogic/amlogic-gxl-core.c @@ -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); -- 2.39.5