All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thorsten Blum <thorsten.blum@linux.dev>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/6] crypto: acomp - Use unregister_acomps in register_acomps
Date: Fri, 19 Dec 2025 15:51:17 +0100	[thread overview]
Message-ID: <20251219145124.36792-1-thorsten.blum@linux.dev> (raw)

Replace the for loop with a call to crypto_unregister_acomps(). Return
'ret' immediately and remove the goto statement to simplify the error
handling code.  No functional changes.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 crypto/acompress.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/crypto/acompress.c b/crypto/acompress.c
index be28cbfd22e3..b353615fe265 100644
--- a/crypto/acompress.c
+++ b/crypto/acompress.c
@@ -337,17 +337,13 @@ int crypto_register_acomps(struct acomp_alg *algs, int count)
 
 	for (i = 0; i < count; i++) {
 		ret = crypto_register_acomp(&algs[i]);
-		if (ret)
-			goto err;
+		if (ret) {
+			crypto_unregister_acomps(algs, i);
+			return ret;
+		}
 	}
 
 	return 0;
-
-err:
-	for (--i; i >= 0; --i)
-		crypto_unregister_acomp(&algs[i]);
-
-	return ret;
 }
 EXPORT_SYMBOL_GPL(crypto_register_acomps);
 
-- 
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4


             reply	other threads:[~2025-12-19 14:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-19 14:51 Thorsten Blum [this message]
2025-12-19 14:51 ` [PATCH 2/6] crypto: ahash - Use unregister_ahashes in register_ahashes Thorsten Blum
2025-12-19 14:51 ` [PATCH 3/6] crypto: shash - Use unregister_shashes in register_shashes Thorsten Blum
2025-12-19 14:51 ` [PATCH 4/6] crypto: skcipher - Use unregister_skciphers in register_skciphers Thorsten Blum
2025-12-19 14:51 ` [PATCH 5/6] crypto: lskcipher - Use unregister_lskciphers in register_lskciphers Thorsten Blum
2025-12-19 14:51 ` [PATCH 6/6] crypto: engine - Use unregister_* in register_{aeads,ahashes,skciphers} Thorsten Blum
2026-01-23  5:53 ` [PATCH 1/6] crypto: acomp - Use unregister_acomps in register_acomps Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251219145124.36792-1-thorsten.blum@linux.dev \
    --to=thorsten.blum@linux.dev \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.