Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit e02ea6f

Browse files
Wolfram Sangherbertx
authored andcommitted
crypto: sahara - use 'time_left' variable with wait_for_completion_timeout()
There is a confusing pattern in the kernel to use a variable named 'timeout' to store the result of wait_for_completion_timeout() causing patterns like: timeout = wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the code self explaining. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 98f9e44 commit e02ea6f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/crypto/sahara.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ static int sahara_aes_process(struct skcipher_request *req)
559559
struct sahara_ctx *ctx;
560560
struct sahara_aes_reqctx *rctx;
561561
int ret;
562-
unsigned long timeout;
562+
unsigned long time_left;
563563

564564
/* Request is ready to be dispatched by the device */
565565
dev_dbg(dev->device,
@@ -597,15 +597,15 @@ static int sahara_aes_process(struct skcipher_request *req)
597597
if (ret)
598598
return -EINVAL;
599599

600-
timeout = wait_for_completion_timeout(&dev->dma_completion,
601-
msecs_to_jiffies(SAHARA_TIMEOUT_MS));
600+
time_left = wait_for_completion_timeout(&dev->dma_completion,
601+
msecs_to_jiffies(SAHARA_TIMEOUT_MS));
602602

603603
dma_unmap_sg(dev->device, dev->out_sg, dev->nb_out_sg,
604604
DMA_FROM_DEVICE);
605605
dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg,
606606
DMA_TO_DEVICE);
607607

608-
if (!timeout) {
608+
if (!time_left) {
609609
dev_err(dev->device, "AES timeout\n");
610610
return -ETIMEDOUT;
611611
}
@@ -931,7 +931,7 @@ static int sahara_sha_process(struct ahash_request *req)
931931
struct sahara_dev *dev = dev_ptr;
932932
struct sahara_sha_reqctx *rctx = ahash_request_ctx(req);
933933
int ret;
934-
unsigned long timeout;
934+
unsigned long time_left;
935935

936936
ret = sahara_sha_prepare_request(req);
937937
if (!ret)
@@ -963,14 +963,14 @@ static int sahara_sha_process(struct ahash_request *req)
963963

964964
sahara_write(dev, dev->hw_phys_desc[0], SAHARA_REG_DAR);
965965

966-
timeout = wait_for_completion_timeout(&dev->dma_completion,
967-
msecs_to_jiffies(SAHARA_TIMEOUT_MS));
966+
time_left = wait_for_completion_timeout(&dev->dma_completion,
967+
msecs_to_jiffies(SAHARA_TIMEOUT_MS));
968968

969969
if (rctx->sg_in_idx)
970970
dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg,
971971
DMA_TO_DEVICE);
972972

973-
if (!timeout) {
973+
if (!time_left) {
974974
dev_err(dev->device, "SHA timeout\n");
975975
return -ETIMEDOUT;
976976
}

0 commit comments

Comments
 (0)