[PATCH 1/2] crypto: qce - simplify devm_qce_register_algs

Thorsten Blum <[email protected]>
Newsgroups org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-crypto,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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 <[email protected]>
---
 drivers/crypto/qce/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
index ea5b9689ce68..a848fd58a354 100644
--- a/drivers/crypto/qce/core.c
+++ b/drivers/crypto/qce/core.c
@@ -51,14 +51,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;
 		}
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.