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

* [PATCH 2/6] crypto: ahash - Use unregister_ahashes in register_ahashes
  2025-12-19 14:51 [PATCH 1/6] crypto: acomp - Use unregister_acomps in register_acomps Thorsten Blum
@ 2025-12-19 14:51 ` Thorsten Blum
  2025-12-19 14:51 ` [PATCH 3/6] crypto: shash - Use unregister_shashes in register_shashes Thorsten Blum
                   ` (3 subsequent siblings)
  4 siblings, 0 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_ahashes(). 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/ahash.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/crypto/ahash.c b/crypto/ahash.c
index 66492ae75fcf..c563a68dc000 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -1020,17 +1020,13 @@ int crypto_register_ahashes(struct ahash_alg *algs, int count)
 
 	for (i = 0; i < count; i++) {
 		ret = crypto_register_ahash(&algs[i]);
-		if (ret)
-			goto err;
+		if (ret) {
+			crypto_unregister_ahashes(algs, i);
+			return ret;
+		}
 	}
 
 	return 0;
-
-err:
-	for (--i; i >= 0; --i)
-		crypto_unregister_ahash(&algs[i]);
-
-	return ret;
 }
 EXPORT_SYMBOL_GPL(crypto_register_ahashes);
 
-- 
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

* [PATCH 3/6] crypto: shash - Use unregister_shashes in register_shashes
  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 ` Thorsten Blum
  2025-12-19 14:51 ` [PATCH 4/6] crypto: skcipher - Use unregister_skciphers in register_skciphers Thorsten Blum
                   ` (2 subsequent siblings)
  4 siblings, 0 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_shashes(). 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/shash.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/crypto/shash.c b/crypto/shash.c
index 4721f5f134f4..5238e0def4fd 100644
--- a/crypto/shash.c
+++ b/crypto/shash.c
@@ -542,17 +542,13 @@ int crypto_register_shashes(struct shash_alg *algs, int count)
 
 	for (i = 0; i < count; i++) {
 		ret = crypto_register_shash(&algs[i]);
-		if (ret)
-			goto err;
+		if (ret) {
+			crypto_unregister_shashes(algs, i);
+			return ret;
+		}
 	}
 
 	return 0;
-
-err:
-	for (--i; i >= 0; --i)
-		crypto_unregister_shash(&algs[i]);
-
-	return ret;
 }
 EXPORT_SYMBOL_GPL(crypto_register_shashes);
 
-- 
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

* [PATCH 4/6] crypto: skcipher - Use unregister_skciphers in register_skciphers
  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
  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
  4 siblings, 0 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_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


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

* [PATCH 5/6] crypto: lskcipher - Use unregister_lskciphers in register_lskciphers
  2025-12-19 14:51 [PATCH 1/6] crypto: acomp - Use unregister_acomps in register_acomps Thorsten Blum
                   ` (2 preceding siblings ...)
  2025-12-19 14:51 ` [PATCH 4/6] crypto: skcipher - Use unregister_skciphers in register_skciphers Thorsten Blum
@ 2025-12-19 14:51 ` Thorsten Blum
  2025-12-19 14:51 ` [PATCH 6/6] crypto: engine - Use unregister_* in register_{aeads,ahashes,skciphers} Thorsten Blum
  4 siblings, 0 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_lskciphers().
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/lskcipher.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/crypto/lskcipher.c b/crypto/lskcipher.c
index c2e2c38b5aa8..bb166250b732 100644
--- a/crypto/lskcipher.c
+++ b/crypto/lskcipher.c
@@ -384,17 +384,13 @@ int crypto_register_lskciphers(struct lskcipher_alg *algs, int count)
 
 	for (i = 0; i < count; i++) {
 		ret = crypto_register_lskcipher(&algs[i]);
-		if (ret)
-			goto err;
+		if (ret) {
+			crypto_unregister_lskciphers(algs, i);
+			return ret;
+		}
 	}
 
 	return 0;
-
-err:
-	for (--i; i >= 0; --i)
-		crypto_unregister_lskcipher(&algs[i]);
-
-	return ret;
 }
 EXPORT_SYMBOL_GPL(crypto_register_lskciphers);
 
-- 
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

* [PATCH 6/6] crypto: engine - Use unregister_* in register_{aeads,ahashes,skciphers}
  2025-12-19 14:51 [PATCH 1/6] crypto: acomp - Use unregister_acomps in register_acomps Thorsten Blum
                   ` (3 preceding siblings ...)
  2025-12-19 14:51 ` [PATCH 5/6] crypto: lskcipher - Use unregister_lskciphers in register_lskciphers Thorsten Blum
@ 2025-12-19 14:51 ` Thorsten Blum
  4 siblings, 0 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 loops with calls to unregister_aeads(),
unregister_ahashes(), and unregister_skciphers(), respectively. Return
'ret' immediately and remove the goto statements to simplify the error
handling code.  No functional changes.

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

diff --git a/crypto/crypto_engine.c b/crypto/crypto_engine.c
index 18e1689efe12..e124bb773958 100644
--- a/crypto/crypto_engine.c
+++ b/crypto/crypto_engine.c
@@ -524,16 +524,13 @@ int crypto_engine_register_aeads(struct aead_engine_alg *algs, int count)
 
 	for (i = 0; i < count; i++) {
 		ret = crypto_engine_register_aead(&algs[i]);
-		if (ret)
-			goto err;
+		if (ret) {
+			crypto_engine_unregister_aeads(algs, i);
+			return ret;
+		}
 	}
 
 	return 0;
-
-err:
-	crypto_engine_unregister_aeads(algs, i);
-
-	return ret;
 }
 EXPORT_SYMBOL_GPL(crypto_engine_register_aeads);
 
@@ -566,16 +563,13 @@ int crypto_engine_register_ahashes(struct ahash_engine_alg *algs, int count)
 
 	for (i = 0; i < count; i++) {
 		ret = crypto_engine_register_ahash(&algs[i]);
-		if (ret)
-			goto err;
+		if (ret) {
+			crypto_engine_unregister_ahashes(algs, i);
+			return ret;
+		}
 	}
 
 	return 0;
-
-err:
-	crypto_engine_unregister_ahashes(algs, i);
-
-	return ret;
 }
 EXPORT_SYMBOL_GPL(crypto_engine_register_ahashes);
 
@@ -638,16 +632,13 @@ int crypto_engine_register_skciphers(struct skcipher_engine_alg *algs,
 
 	for (i = 0; i < count; i++) {
 		ret = crypto_engine_register_skcipher(&algs[i]);
-		if (ret)
-			goto err;
+		if (ret) {
+			crypto_engine_unregister_skciphers(algs, i);
+			return ret;
+		}
 	}
 
 	return 0;
-
-err:
-	crypto_engine_unregister_skciphers(algs, i);
-
-	return ret;
 }
 EXPORT_SYMBOL_GPL(crypto_engine_register_skciphers);
 
-- 
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).