Blob Blame History Raw
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date: Sun, 12 Jul 2020 23:14:04 +0200
Subject: crypto: chelsio - Avoid some code duplication
Patch-mainline: v5.9-rc1
Git-commit: d110cf0ac1bf24ac098b8ea5b0188c717acf7a02
References: jsc#SLE-15129

The error handling path of 'chcr_authenc_setkey()' is the same as this
error handling code.

So just 'goto out' as done everywhere in the function to simplify the code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 drivers/crypto/chelsio/chcr_algo.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -3627,9 +3627,7 @@ static int chcr_authenc_setkey(struct cr
 	base_hash  = chcr_alloc_shash(max_authsize);
 	if (IS_ERR(base_hash)) {
 		pr_err("chcr : Base driver cannot be loaded\n");
-		aeadctx->enckey_len = 0;
-		memzero_explicit(&keys, sizeof(keys));
-		return -EINVAL;
+		goto out;
 	}
 	{
 		SHASH_DESC_ON_STACK(shash, base_hash);