[v2,03/10] staging: ccree: simplify AEAD using local var

Message ID 1510218980-3549-4-git-send-email-gilad@benyossef.com
State New
Headers show
Series
  • [v2,01/10] staging: ccree: fix leak of import() after init()
Related show

Commit Message

Gilad Ben-Yossef Nov. 9, 2017, 9:16 a.m.
Make the code more readable by using a local variable
for commonly use expression in the AEAD part of the driver.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>

---
 drivers/staging/ccree/ssi_aead.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

-- 
2.7.4

Patch

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index 0b5b230..a8e1371 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -251,13 +251,11 @@  static void ssi_aead_complete(struct device *dev, void *ssi_req, void __iomem *c
 		}
 	} else { /*ENCRYPT*/
 		if (unlikely(areq_ctx->is_icv_fragmented)) {
+			u32 skip = areq->cryptlen + areq_ctx->dst_offset;
+
 			cc_copy_sg_portion(dev, areq_ctx->mac_buf,
-					   areq_ctx->dst_sgl,
-					   (areq->cryptlen +
-					    areq_ctx->dst_offset),
-					   (areq->cryptlen +
-					    areq_ctx->dst_offset +
-					    ctx->authsize),
+					   areq_ctx->dst_sgl, skip,
+					   (skip + ctx->authsize),
 					   SSI_SG_FROM_BUF);
 		}