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 4/6] crypto: skcipher - Use unregister_skciphers in register_skciphers
Date: Fri, 19 Dec 2025 15:51:20 +0100 [thread overview]
Message-ID: <20251219145124.36792-4-thorsten.blum@linux.dev> (raw)
In-Reply-To: <20251219145124.36792-1-thorsten.blum@linux.dev>
Replace the for loop with a call to crypto_unregister_skciphers().
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/skcipher.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/crypto/skcipher.c b/crypto/skcipher.c
index 14a820cb06c7..09f1ba82f99a 100644
--- a/crypto/skcipher.c
+++ b/crypto/skcipher.c
@@ -741,17 +741,13 @@ int crypto_register_skciphers(struct skcipher_alg *algs, int count)
for (i = 0; i < count; i++) {
ret = crypto_register_skcipher(&algs[i]);
- if (ret)
- goto err;
+ if (ret) {
+ crypto_unregister_skciphers(algs, i);
+ return ret;
+ }
}
return 0;
-
-err:
- for (--i; i >= 0; --i)
- crypto_unregister_skcipher(&algs[i]);
-
- return ret;
}
EXPORT_SYMBOL_GPL(crypto_register_skciphers);
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
next prev parent 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 [PATCH 1/6] crypto: acomp - Use unregister_acomps in register_acomps Thorsten Blum
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 ` Thorsten Blum [this message]
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-4-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.