diff mbox series

[v4] crypto: qat - Replace the if statement with min()

Message ID 20230704065643.32220-1-youkangren@vivo.com
State Superseded
Headers show
Series [v4] crypto: qat - Replace the if statement with min() | expand

Commit Message

You Kangren July 4, 2023, 6:56 a.m. UTC
mark UWORD_CPYBUF_SIZE with U suffix to make the type the same with
words_num and replace the if statement with min() in 
qat_uclo_wr_uimage_raw_page() to make code shorter

Signed-off-by: You Kangren <youkangren@vivo.com>
---
 drivers/crypto/intel/qat/qat_common/qat_uclo.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Andy Shevchenko July 4, 2023, 7:15 a.m. UTC | #1
On Tue, Jul 04, 2023 at 02:56:39PM +0800, You Kangren wrote:
> mark UWORD_CPYBUF_SIZE with U suffix to make the type the same with

You need to respect English grammar and punctuation.
Here should be

  Mark...

> words_num and replace the if statement with min() in 

(drop trailing space)

> qat_uclo_wr_uimage_raw_page() to make code shorter

...and here the period is missing.

Also, Haven't I given my tag? Why it's not added?

> Signed-off-by: You Kangren <youkangren@vivo.com>
> ---

Where is the changelog from v3? What had been changed so far?
diff mbox series

Patch

diff --git a/drivers/crypto/intel/qat/qat_common/qat_uclo.c b/drivers/crypto/intel/qat/qat_common/qat_uclo.c
index ce837bcc1cab..4bd150d1441a 100644
--- a/drivers/crypto/intel/qat/qat_common/qat_uclo.c
+++ b/drivers/crypto/intel/qat/qat_common/qat_uclo.c
@@ -11,7 +11,7 @@ 
 #include "icp_qat_hal.h"
 #include "icp_qat_fw_loader_handle.h"
 
-#define UWORD_CPYBUF_SIZE 1024
+#define UWORD_CPYBUF_SIZE 1024U
 #define INVLD_UWORD 0xffffffffffull
 #define PID_MINOR_REV 0xf
 #define PID_MAJOR_REV (0xf << 4)
@@ -1986,10 +1986,7 @@  static void qat_uclo_wr_uimage_raw_page(struct icp_qat_fw_loader_handle *handle,
 	uw_relative_addr = 0;
 	words_num = encap_page->micro_words_num;
 	while (words_num) {
-		if (words_num < UWORD_CPYBUF_SIZE)
-			cpylen = words_num;
-		else
-			cpylen = UWORD_CPYBUF_SIZE;
+		cpylen = min(words_num, UWORD_CPYBUF_SIZE);
 
 		/* load the buffer */
 		for (i = 0; i < cpylen; i++)