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:
Thorsten Blum
2026-07-31 12:25:32 +02:00
committed by Herbert Xu
parent 9a955c0a7d
commit bf3285b7a7

View File

@@ -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;
}
}