summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@linux.dev>2025-12-19 15:51:18 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2026-01-23 13:48:42 +0800
commitbcc3b3c8ae49d00c8e6a4a7616ef74ef0b176daf (patch)
tree64e5d1ecbeb5185a204101fd7002081cdf320a0f /crypto
parentfbbc944b5945bfd2715a3d762784c318a040f36a (diff)
crypto: ahash - Use unregister_ahashes in register_ahashes
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> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/ahash.c12
1 files 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);