[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250801111345.1849656-1-darshanrathod475@gmail.com>
Date: Fri, 1 Aug 2025 16:43:45 +0530
From: darshanrathod475@...il.com
To: herbert@...dor.apana.org.au
Cc: davem@...emloft.net,
linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org,
Darshan Rathod <darshanrathod475@...il.com>
Subject: [PATCH] crypto: padlock: fix assignment in if condition and minor style issues
From: Darshan Rathod <darshanrathod475@...il.com>
Refactor to remove assignments from inside if conditions, as required
by kernel coding style. This improves code readability and resolves
checkpatch.pl warnings:
ERROR: do not use assignment in if condition
While at it, also cleaned up minor style issues:
- Removed extra whitespace in a multi-line comment.
- Fixed parameter indentation in cbc_crypt_copy() for consistency.
Signed-off-by: Darshan Rathod <darshanrathod475@...il.com>
---
drivers/crypto/padlock-aes.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index 1be549a07a21..f5db0442a422 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
-/*
+/*
* Cryptographic API.
*
* Support for VIA PadLock hardware crypto engine.
@@ -77,8 +77,8 @@ static inline int
aes_hw_extkey_available(uint8_t key_len)
{
/* TODO: We should check the actual CPU model/stepping
- as it's possible that the capability will be
- added in the next CPU revisions. */
+ as it's possible that the capability will be
+ added in the next CPU revisions. */
if (key_len == 16)
return 1;
return 0;
@@ -223,7 +223,7 @@ static void ecb_crypt_copy(const u8 *in, u8 *out, u32 *key,
}
static u8 *cbc_crypt_copy(const u8 *in, u8 *out, u32 *key,
- u8 *iv, struct cword *cword, int count)
+ u8 *iv, struct cword *cword, int count)
{
/*
* Padlock prefetches extra data so we must provide mapped input buffers.
@@ -493,13 +493,16 @@ static int __init padlock_init(void)
return -ENODEV;
}
- if ((ret = crypto_register_alg(&aes_alg)) != 0)
+ ret = crypto_register_alg(&aes_alg);
+ if (ret != 0)
goto aes_err;
- if ((ret = crypto_register_skcipher(&ecb_aes_alg)) != 0)
+ ret = crypto_register_skcipher(&ecb_aes_alg);
+ if (ret != 0)
goto ecb_aes_err;
- if ((ret = crypto_register_skcipher(&cbc_aes_alg)) != 0)
+ ret = crypto_register_skcipher(&cbc_aes_alg);
+ if (ret != 0)
goto cbc_aes_err;
printk(KERN_NOTICE PFX "Using VIA PadLock ACE for AES algorithm.\n");
--
2.25.1
Powered by blists - more mailing lists