Skip to contentSkip to conversation

crypto: chcr - Replace _manual_ swap with swap macro

PATCH In review Gustavo A. R. Silva 2 participants 2 messages Nov 3, 2017 – Nov 6, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: chcr - Replace _manual_ swap with swap macro

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.

---
 drivers/crypto/chelsio/chcr_algo.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/crypto/chelsio/chcr_algo.c +1 -4
index 936bdd8..4b508cb 100644
@@ -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);
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 6 lines · Gustavo A. R. Silva

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.

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt