From: Thorsten Blum Date: Thu, 11 Dec 2025 08:52:51 +0000 (+0100) Subject: crypto: scompress - Use crypto_unregister_scomps in crypto_register_scomps X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e602c5f04943a0a123aef69076ef9305c484c53;p=thirdparty%2Fkernel%2Flinux.git crypto: scompress - Use crypto_unregister_scomps in crypto_register_scomps Replace the for loop with a call to crypto_unregister_scomps(). 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 --- diff --git a/crypto/scompress.c b/crypto/scompress.c index 70ceb2fe3d7fc..456b04a3d01e0 100644 --- a/crypto/scompress.c +++ b/crypto/scompress.c @@ -381,17 +381,13 @@ int crypto_register_scomps(struct scomp_alg *algs, int count) for (i = 0; i < count; i++) { ret = crypto_register_scomp(&algs[i]); - if (ret) - goto err; + if (ret) { + crypto_unregister_scomps(algs, i); + return ret; + } } return 0; - -err: - for (--i; i >= 0; --i) - crypto_unregister_scomp(&algs[i]); - - return ret; } EXPORT_SYMBOL_GPL(crypto_register_scomps);