summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@linux.dev>2025-12-11 09:52:51 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2025-12-19 14:47:47 +0800
commit0e602c5f04943a0a123aef69076ef9305c484c53 (patch)
tree6d9443249e02357e8a1bf5f626257edfed008223 /crypto
parentbb571875f77f2af259b6e2cca91b10964bcd0d79 (diff)
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 <thorsten.blum@linux.dev> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/scompress.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/crypto/scompress.c b/crypto/scompress.c
index 70ceb2fe3d7f..456b04a3d01e 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);