Skip to content

Commit 8b3ad41

Browse files
tobluxherbertx
authored andcommitted
crypto: rng - Use unregister_rngs in register_rngs
Replace the for loop with a call to crypto_unregister_rngs(). 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>
1 parent 2ffc1ef commit 8b3ad41

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

crypto/rng.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,17 +202,13 @@ int crypto_register_rngs(struct rng_alg *algs, int count)
202202

203203
for (i = 0; i < count; i++) {
204204
ret = crypto_register_rng(algs + i);
205-
if (ret)
206-
goto err;
205+
if (ret) {
206+
crypto_unregister_rngs(algs, i);
207+
return ret;
208+
}
207209
}
208210

209211
return 0;
210-
211-
err:
212-
for (--i; i >= 0; --i)
213-
crypto_unregister_rng(algs + i);
214-
215-
return ret;
216212
}
217213
EXPORT_SYMBOL_GPL(crypto_register_rngs);
218214

0 commit comments

Comments
 (0)