Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH 1/2] crypto: qce - simplify devm_qce_register_algs
@ 2026-07-31 10:25 Thorsten Blum
  2026-07-31 10:25 ` [PATCH 2/2] crypto: qce - simplify qce_handle_request Thorsten Blum
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-07-31 10:25 UTC (permalink / raw)
  To: Bartosz Golaszewski, Herbert Xu, David S. Miller
  Cc: Thorsten Blum, linux-crypto, linux-arm-msm, linux-kernel

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] crypto: qce - simplify qce_handle_request
  2026-07-31 10:25 [PATCH 1/2] crypto: qce - simplify devm_qce_register_algs Thorsten Blum
@ 2026-07-31 10:25 ` Thorsten Blum
  0 siblings, 0 replies; 2+ messages in thread
From: Thorsten Blum @ 2026-07-31 10:25 UTC (permalink / raw)
  To: Bartosz Golaszewski, Herbert Xu, David S. Miller
  Cc: Thorsten Blum, linux-crypto, linux-arm-msm, linux-kernel

Simplify the for loop's control flow and return the results directly.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/crypto/qce/core.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
index a848fd58a354..dc05f2b9d52e 100644
--- a/drivers/crypto/qce/core.c
+++ b/drivers/crypto/qce/core.c
@@ -68,19 +68,17 @@ static int devm_qce_register_algs(struct qce_device *qce)
 
 static int qce_handle_request(struct crypto_async_request *async_req)
 {
-	int ret = -EINVAL, i;
+	int i;
 	const struct qce_algo_ops *ops;
 	u32 type = crypto_tfm_alg_type(async_req->tfm);
 
 	for (i = 0; i < ARRAY_SIZE(qce_ops); i++) {
 		ops = qce_ops[i];
-		if (type != ops->type)
-			continue;
-		ret = ops->async_req_handle(async_req);
-		break;
+		if (type == ops->type)
+			return ops->async_req_handle(async_req);
 	}
 
-	return ret;
+	return -EINVAL;
 }
 
 static int qce_handle_queue(struct qce_device *qce,

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-31 10:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-31 10:25 [PATCH 1/2] crypto: qce - simplify devm_qce_register_algs Thorsten Blum
2026-07-31 10:25 ` [PATCH 2/2] crypto: qce - simplify qce_handle_request Thorsten Blum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox