linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] crypto: acomp - Use unregister_acomps in register_acomps
@ 2025-12-19 14:51 Thorsten Blum
  2025-12-19 14:51 ` [PATCH 2/6] crypto: ahash - Use unregister_ahashes in register_ahashes Thorsten Blum
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Thorsten Blum @ 2025-12-19 14:51 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: Thorsten Blum, linux-crypto, linux-kernel

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-12-19 14:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).