]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: lskcipher - Use unregister_lskciphers in register_lskciphers
authorThorsten Blum <thorsten.blum@linux.dev>
Fri, 19 Dec 2025 14:51:21 +0000 (15:51 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 23 Jan 2026 05:48:42 +0000 (13:48 +0800)
Replace the for loop with a call to crypto_unregister_lskciphers().
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/lskcipher.c

index c2e2c38b5aa8d8b8c23a88e418154424e2e22f5d..bb166250b732718db57208b9956745a91633a1b7 100644 (file)
@@ -384,17 +384,13 @@ int crypto_register_lskciphers(struct lskcipher_alg *algs, int count)
 
        for (i = 0; i < count; i++) {
                ret = crypto_register_lskcipher(&algs[i]);
-               if (ret)
-                       goto err;
+               if (ret) {
+                       crypto_unregister_lskciphers(algs, i);
+                       return ret;
+               }
        }
 
        return 0;
-
-err:
-       for (--i; i >= 0; --i)
-               crypto_unregister_lskcipher(&algs[i]);
-
-       return ret;
 }
 EXPORT_SYMBOL_GPL(crypto_register_lskciphers);