linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: chcr - Replace _manual_ swap with swap macro
@ 2017-11-03 16:58 Gustavo A. R. Silva
  2017-11-06  7:09 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2017-11-03 16:58 UTC (permalink / raw)
  To: Harsh Jain, Herbert Xu, David S. Miller
  Cc: linux-crypto, linux-kernel, 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.

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

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);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: chcr - Replace _manual_ swap with swap macro
  2017-11-03 16:58 [PATCH] crypto: chcr - Replace _manual_ swap with swap macro Gustavo A. R. Silva
@ 2017-11-06  7:09 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2017-11-06  7:09 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Harsh Jain, David S. Miller, linux-crypto, linux-kernel

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.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-06  7:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-03 16:58 [PATCH] crypto: chcr - Replace _manual_ swap with swap macro Gustavo A. R. Silva
2017-11-06  7:09 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).