diff options
author | Zain Wang <wzz@rock-chips.com> | 2017-07-24 04:23:14 +0300 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-08-03 09:00:23 +0300 |
commit | 9a42e4eed3fcd7ba8dff6622384cd08bfe5ef707 (patch) | |
tree | 028c03333db731d410cf51018598301a4b1dca8b /drivers/crypto/rockchip/rk3288_crypto_ablkcipher.c | |
parent | 641eacd15696a65b08880985701c8082872da136 (diff) | |
download | linux-9a42e4eed3fcd7ba8dff6622384cd08bfe5ef707.tar.xz |
crypto: rockchip - return the err code when unable dequeue the crypto request
Sometime we would unable to dequeue the crypto request, in this case,
we should finish crypto and return the err code.
Signed-off-by: zain wang <wzz@rock-chips.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/rockchip/rk3288_crypto_ablkcipher.c')
-rw-r--r-- | drivers/crypto/rockchip/rk3288_crypto_ablkcipher.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/crypto/rockchip/rk3288_crypto_ablkcipher.c b/drivers/crypto/rockchip/rk3288_crypto_ablkcipher.c index 8787e44593f8..dbe78def7b65 100644 --- a/drivers/crypto/rockchip/rk3288_crypto_ablkcipher.c +++ b/drivers/crypto/rockchip/rk3288_crypto_ablkcipher.c @@ -25,6 +25,7 @@ static int rk_handle_req(struct rk_crypto_info *dev, struct ablkcipher_request *req) { unsigned long flags; + struct crypto_async_request *async_req, *backlog; int err; if (!IS_ALIGNED(req->nbytes, dev->align_size)) @@ -41,7 +42,21 @@ static int rk_handle_req(struct rk_crypto_info *dev, spin_lock_irqsave(&dev->lock, flags); err = ablkcipher_enqueue_request(&dev->queue, req); + backlog = crypto_get_backlog(&dev->queue); + async_req = crypto_dequeue_request(&dev->queue); spin_unlock_irqrestore(&dev->lock, flags); + + if (!async_req) { + dev_err(dev->dev, "async_req is NULL !!\n"); + return err; + } + if (backlog) { + backlog->complete(backlog, -EINPROGRESS); + backlog = NULL; + } + + dev->ablk_req = ablkcipher_request_cast(async_req); + tasklet_schedule(&dev->queue_task); return err; } |