[PATCH] crypto: hisilicon/hpre - use swap() to make code cleaner

DORMANTno replies

From: <hidden>
Date: 2021-10-28 11:04:53
Also in: lkml
Subsystem: crypto api, hisilicon high performance rsa engine driver (hpre), the rest · Maintainers: Herbert Xu, "David S. Miller", Zhiqi Song, Longfang Liu, Linus Torvalds

From: Changcheng Deng <redacted>

Use swap() in order to make code cleaner. Issue found by coccinelle.

Reported-by: Zeal Robot <redacted>
Signed-off-by: Changcheng Deng <redacted>
---
 drivers/crypto/hisilicon/hpre/hpre_crypto.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/crypto/hisilicon/hpre/hpre_crypto.c b/drivers/crypto/hisilicon/hpre/hpre_crypto.c
index a032c192ef1d..f7957197ef10 100644
--- a/drivers/crypto/hisilicon/hpre/hpre_crypto.c
+++ b/drivers/crypto/hisilicon/hpre/hpre_crypto.c
@@ -1177,13 +1177,10 @@ static void hpre_rsa_exit_tfm(struct crypto_akcipher *tfm)
 static void hpre_key_to_big_end(u8 *data, int len)
 {
 	int i, j;
-	u8 tmp;
 
 	for (i = 0; i < len / 2; i++) {
 		j = len - i - 1;
-		tmp = data[j];
-		data[j] = data[i];
-		data[i] = tmp;
+		swap(data[i], data[j]);
 	}
 }
 
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help