]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: scompress - Use crypto_unregister_scomps in crypto_register_scomps
authorThorsten Blum <thorsten.blum@linux.dev>
Thu, 11 Dec 2025 08:52:51 +0000 (09:52 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 19 Dec 2025 06:47:47 +0000 (14:47 +0800)
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>
crypto/scompress.c

index 70ceb2fe3d7fccc7f8f681be7851072672782bba..456b04a3d01e0440794c4b264ff2574d54983c64 100644 (file)
@@ -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);