Commit 6dc156f4 authored by Thomas Petazzoni's avatar Thomas Petazzoni Committed by Herbert Xu

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: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 3e5c66c9
...@@ -403,15 +403,16 @@ static inline int mv_cesa_ahash_cra_init(struct crypto_tfm *tfm) ...@@ -403,15 +403,16 @@ static inline int mv_cesa_ahash_cra_init(struct crypto_tfm *tfm)
return 0; return 0;
} }
static int mv_cesa_ahash_cache_req(struct ahash_request *req, bool *cached) static bool mv_cesa_ahash_cache_req(struct ahash_request *req)
{ {
struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); struct mv_cesa_ahash_req *creq = ahash_request_ctx(req);
bool cached = false;
if (creq->cache_ptr + req->nbytes < 64 && !creq->last_req) { if (creq->cache_ptr + req->nbytes < 64 && !creq->last_req) {
*cached = true; cached = true;
if (!req->nbytes) if (!req->nbytes)
return 0; return cached;
sg_pcopy_to_buffer(req->src, creq->src_nents, sg_pcopy_to_buffer(req->src, creq->src_nents,
creq->cache + creq->cache_ptr, creq->cache + creq->cache_ptr,
...@@ -420,7 +421,7 @@ static int mv_cesa_ahash_cache_req(struct ahash_request *req, bool *cached) ...@@ -420,7 +421,7 @@ static int mv_cesa_ahash_cache_req(struct ahash_request *req, bool *cached)
creq->cache_ptr += req->nbytes; creq->cache_ptr += req->nbytes;
} }
return 0; return cached;
} }
static struct mv_cesa_op_ctx * static struct mv_cesa_op_ctx *
...@@ -665,7 +666,6 @@ static int mv_cesa_ahash_dma_req_init(struct ahash_request *req) ...@@ -665,7 +666,6 @@ static int mv_cesa_ahash_dma_req_init(struct ahash_request *req)
static int mv_cesa_ahash_req_init(struct ahash_request *req, bool *cached) static int mv_cesa_ahash_req_init(struct ahash_request *req, bool *cached)
{ {
struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); struct mv_cesa_ahash_req *creq = ahash_request_ctx(req);
int ret;
creq->src_nents = sg_nents_for_len(req->src, req->nbytes); creq->src_nents = sg_nents_for_len(req->src, req->nbytes);
if (creq->src_nents < 0) { if (creq->src_nents < 0) {
...@@ -673,17 +673,15 @@ static int mv_cesa_ahash_req_init(struct ahash_request *req, bool *cached) ...@@ -673,17 +673,15 @@ static int mv_cesa_ahash_req_init(struct ahash_request *req, bool *cached)
return creq->src_nents; return creq->src_nents;
} }
ret = mv_cesa_ahash_cache_req(req, cached); *cached = mv_cesa_ahash_cache_req(req);
if (ret)
return ret;
if (*cached) if (*cached)
return 0; return 0;
if (cesa_dev->caps->has_tdma) if (cesa_dev->caps->has_tdma)
ret = mv_cesa_ahash_dma_req_init(req); return mv_cesa_ahash_dma_req_init(req);
else
return ret; return 0;
} }
static int mv_cesa_ahash_queue_req(struct ahash_request *req) static int mv_cesa_ahash_queue_req(struct ahash_request *req)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment