linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] crypto: qat - fix some timeout tests
@ 2015-12-15 10:05 Dan Carpenter
  2015-12-15 20:27 ` Tadeusz Struk
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2015-12-15 10:05 UTC (permalink / raw)
  To: Tadeusz Struk
  Cc: Herbert Xu, David S. Miller, Bruce Allan, Pingchao Yang,
	qat-linux, linux-crypto, kernel-janitors

We do an "if (!times)" test later to see if we ran the loop too many
times, but because it is a postop negate that means times is -1 when we
exit that way.  I have fixed this by changing it from a post op to a
preop.

Fixes: b3416fb8a2f5 ('crypto: qat - Intel(R) QAT accelengine part of fw loader')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This means we only loop 9999 times instead of 10000 like before but I
figure it probably doesn't matter.

diff --git a/drivers/crypto/qat/qat_common/qat_hal.c b/drivers/crypto/qat/qat_common/qat_hal.c
index 45c1739..2b078a6 100644
--- a/drivers/crypto/qat/qat_common/qat_hal.c
+++ b/drivers/crypto/qat/qat_common/qat_hal.c
@@ -171,7 +171,7 @@ static int qat_hal_wait_cycles(struct icp_qat_fw_loader_handle *handle,
 
 	qat_hal_rd_ae_csr(handle, ae, PROFILE_COUNT, &base_cnt);
 	base_cnt &= 0xffff;
-	while ((int)cycles > elapsed_cycles && times--) {
+	while ((int)cycles > elapsed_cycles && --times) {
 		if (chk_inactive)
 			qat_hal_rd_ae_csr(handle, ae, ACTIVE_CTX_STATUS, &csr);
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH] crypto: qat - fix some timeout tests
@ 2015-12-16  6:09 Yang Pingchao
  2015-12-22 13:23 ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Yang Pingchao @ 2015-12-16  6:09 UTC (permalink / raw)
  To: herbert, dan.carpenter
  Cc: tadeusz.struk, linux-crypto, qat-linux, kernel-janitors,
	Yang Pingchao

Change the timeout condition since the times value would be -1 after
running MAX_RETRY_TIMES.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Yang Pingchao <pingchao.yang@intel.com>
---
 drivers/crypto/qat/qat_common/qat_hal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/qat/qat_common/qat_hal.c b/drivers/crypto/qat/qat_common/qat_hal.c
index 81bd1fe..0ac0ba8 100644
--- a/drivers/crypto/qat/qat_common/qat_hal.c
+++ b/drivers/crypto/qat/qat_common/qat_hal.c
@@ -186,7 +186,7 @@ static int qat_hal_wait_cycles(struct icp_qat_fw_loader_handle *handle,
 		if (elapsed_cycles >= 8 && !(csr & (1 << ACS_ABO_BITPOS)))
 			return 0;
 	}
-	if (!times) {
+	if (times < 0) {
 		pr_err("QAT: wait_num_cycles time out\n");
 		return -EFAULT;
 	}
-- 
2.6.4

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

end of thread, other threads:[~2015-12-22 13:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-15 10:05 [patch] crypto: qat - fix some timeout tests Dan Carpenter
2015-12-15 20:27 ` Tadeusz Struk
2015-12-15 23:50   ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2015-12-16  6:09 [PATCH] " Yang Pingchao
2015-12-22 13:23 ` 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).