diff mbox

crypto: chcr - Replace _manual_ swap with swap macro

Message ID 20171103165823.GA16842@embeddedor.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Gustavo A. R. Silva Nov. 3, 2017, 4:58 p.m. UTC
Make use of the swap macro and remove unnecessary variable temp.
This makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 drivers/crypto/chelsio/chcr_algo.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Herbert Xu Nov. 6, 2017, 7:09 a.m. UTC | #1
On Fri, Nov 03, 2017 at 11:58:23AM -0500, Gustavo A. R. Silva wrote:
> Make use of the swap macro and remove unnecessary variable temp.
> This makes the code easier to read and maintain.
> 
> This code was detected with the help of Coccinelle.
> 
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>

Patch applied.  Thanks.
diff mbox

Patch

diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index 936bdd8..4b508cb 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -1469,11 +1469,8 @@  static int chcr_ahash_update(struct ahash_request *req)
 		return -ENOMEM;
 
 	if (remainder) {
-		u8 *temp;
 		/* Swap buffers */
-		temp = req_ctx->reqbfr;
-		req_ctx->reqbfr = req_ctx->skbfr;
-		req_ctx->skbfr = temp;
+		swap(req_ctx->reqbfr, req_ctx->skbfr);
 		sg_pcopy_to_buffer(req->src, sg_nents(req->src),
 				   req_ctx->reqbfr, remainder, req->nbytes -
 				   remainder);