mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: darshanrathod475@gmail.com
To: herbert@gondor.apana.org.au
Cc: davem@davemloft.net, linux-crypto@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Darshan Rathod <darshanrathod475@gmail.com>
Subject: [PATCH] crypto: padlock: fix assignment in if condition and minor style issues
Date: Fri,  1 Aug 2025 16:43:45 +0530	[thread overview]
Message-ID: <20250801111345.1849656-1-darshanrathod475@gmail.com> (raw)

From: Darshan Rathod <darshanrathod475@gmail.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@gmail.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


                 reply	other threads:[~2025-08-01 11:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250801111345.1849656-1-darshanrathod475@gmail.com \
    --to=darshanrathod475@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®