aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-08-09 05:03:17 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2016-08-09 06:47:30 -0400
commit6dc156f4536b9f0abb764cb34e652730dcc4883b (patch)
treeaa2d66c766644e1d3655284f90e975aa42dd4b03
parent3e5c66c9c31afecf1d6f7ef4ffc50ac3c1ff3c7c (diff)
crypto: marvell - make mv_cesa_ahash_cache_req() return bool
The mv_cesa_ahash_cache_req() function always returns 0, which makes its return value pretty much useless. However, in addition to returning a useless value, it also returns a boolean in a variable passed by reference to indicate if the request was already cached. So, this commit changes mv_cesa_ahash_cache_req() to return this boolean. It consequently simplifies the only call site of mv_cesa_ahash_cache_req(), where the "ret" variable is no longer needed. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/crypto/marvell/hash.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/crypto/marvell/hash.c b/drivers/crypto/marvell/hash.c
index 729166435a8d..cf8063d8c488 100644
--- a/drivers/crypto/marvell/hash.c
+++ b/drivers/crypto/marvell/hash.c
@@ -403,15 +403,16 @@ static inline int mv_cesa_ahash_cra_init(struct crypto_tfm *tfm)
403 return 0; 403 return 0;
404} 404}
405 405
406static int mv_cesa_ahash_cache_req(struct ahash_request *req, bool *cached) 406static bool mv_cesa_ahash_cache_req(struct ahash_request *req)
407{ 407{
408 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); 408 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req);
409 bool cached = false;
409 410
410 if (creq->cache_ptr + req->nbytes < 64 && !creq->last_req) { 411 if (creq->cache_ptr + req->nbytes < 64 && !creq->last_req) {
411 *cached = true; 412 cached = true;
412 413
413 if (!req->nbytes) 414 if (!req->nbytes)
414 return 0; 415 return cached;
415 416
416 sg_pcopy_to_buffer(req->src, creq->src_nents, 417 sg_pcopy_to_buffer(req->src, creq->src_nents,
417 creq->cache + creq->cache_ptr, 418 creq->cache + creq->cache_ptr,
@@ -420,7 +421,7 @@ static int mv_cesa_ahash_cache_req(struct ahash_request *req, bool *cached)
420 creq->cache_ptr += req->nbytes; 421 creq->cache_ptr += req->nbytes;
421 } 422 }
422 423
423 return 0; 424 return cached;
424} 425}
425 426
426static struct mv_cesa_op_ctx * 427static struct mv_cesa_op_ctx *
@@ -665,7 +666,6 @@ err:
665static int mv_cesa_ahash_req_init(struct ahash_request *req, bool *cached) 666static int mv_cesa_ahash_req_init(struct ahash_request *req, bool *cached)
666{ 667{
667 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); 668 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req);
668 int ret;
669 669
670 creq->src_nents = sg_nents_for_len(req->src, req->nbytes); 670 creq->src_nents = sg_nents_for_len(req->src, req->nbytes);
671 if (creq->src_nents < 0) { 671 if (creq->src_nents < 0) {
@@ -673,17 +673,15 @@ static int mv_cesa_ahash_req_init(struct ahash_request *req, bool *cached)
673 return creq->src_nents; 673 return creq->src_nents;
674 } 674 }
675 675
676 ret = mv_cesa_ahash_cache_req(req, cached); 676 *cached = mv_cesa_ahash_cache_req(req);
677 if (ret)
678 return ret;
679 677
680 if (*cached) 678 if (*cached)
681 return 0; 679 return 0;
682 680
683 if (cesa_dev->caps->has_tdma) 681 if (cesa_dev->caps->has_tdma)
684 ret = mv_cesa_ahash_dma_req_init(req); 682 return mv_cesa_ahash_dma_req_init(req);
685 683 else
686 return ret; 684 return 0;
687} 685}
688 686
689static int mv_cesa_ahash_queue_req(struct ahash_request *req) 687static int mv_cesa_ahash_queue_req(struct ahash_request *req)