mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 09:20:13 -04:00
crypto: qce - simplify devm_qce_register_algs
Drop the redundant ret = -ENODEV initialization. Use a while loop and reuse the local index variable i on the error path. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
committed by
Herbert Xu
parent
9a955c0a7d
commit
bf3285b7a7
@@ -54,14 +54,14 @@ static void qce_unregister_algs(void *data)
|
||||
static int devm_qce_register_algs(struct qce_device *qce)
|
||||
{
|
||||
const struct qce_algo_ops *ops;
|
||||
int i, j, ret = -ENODEV;
|
||||
int i, ret;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(qce_ops); i++) {
|
||||
ops = qce_ops[i];
|
||||
ret = ops->register_algs(qce);
|
||||
if (ret) {
|
||||
for (j = i - 1; j >= 0; j--)
|
||||
qce_ops[j]->unregister_algs(qce);
|
||||
while (i--)
|
||||
qce_ops[i]->unregister_algs(qce);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user