From bcc3b3c8ae49d00c8e6a4a7616ef74ef0b176daf Mon Sep 17 00:00:00 2001 From: Thorsten Blum Date: Fri, 19 Dec 2025 15:51:18 +0100 Subject: [PATCH] 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 Signed-off-by: Herbert Xu --- crypto/ahash.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/crypto/ahash.c b/crypto/ahash.c index 66492ae75fcfb..c563a68dc000c 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); -- 2.47.3