Commit c0e77a11 authored by Pingchao Yang's avatar Pingchao Yang Committed by Herbert Xu

crypto: qat - fix timeout issues

Change the variable times data type and timeout conditon since the value
of times should be -1 after loop.
Signed-off-by: default avatarYang Pingchao <pingchao.yang@intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 91a93eaf
...@@ -389,7 +389,7 @@ static int qat_hal_check_ae_alive(struct icp_qat_fw_loader_handle *handle) ...@@ -389,7 +389,7 @@ static int qat_hal_check_ae_alive(struct icp_qat_fw_loader_handle *handle)
{ {
unsigned int base_cnt, cur_cnt; unsigned int base_cnt, cur_cnt;
unsigned char ae; unsigned char ae;
unsigned int times = MAX_RETRY_TIMES; int times = MAX_RETRY_TIMES;
for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) { for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) {
qat_hal_rd_ae_csr(handle, ae, PROFILE_COUNT, qat_hal_rd_ae_csr(handle, ae, PROFILE_COUNT,
...@@ -402,7 +402,7 @@ static int qat_hal_check_ae_alive(struct icp_qat_fw_loader_handle *handle) ...@@ -402,7 +402,7 @@ static int qat_hal_check_ae_alive(struct icp_qat_fw_loader_handle *handle)
cur_cnt &= 0xffff; cur_cnt &= 0xffff;
} while (times-- && (cur_cnt == base_cnt)); } while (times-- && (cur_cnt == base_cnt));
if (!times) { if (times < 0) {
pr_err("QAT: AE%d is inactive!!\n", ae); pr_err("QAT: AE%d is inactive!!\n", ae);
return -EFAULT; return -EFAULT;
} }
...@@ -453,7 +453,8 @@ static int qat_hal_init_esram(struct icp_qat_fw_loader_handle *handle) ...@@ -453,7 +453,8 @@ static int qat_hal_init_esram(struct icp_qat_fw_loader_handle *handle)
void __iomem *csr_addr = void __iomem *csr_addr =
(void __iomem *)((uintptr_t)handle->hal_ep_csr_addr_v + (void __iomem *)((uintptr_t)handle->hal_ep_csr_addr_v +
ESRAM_AUTO_INIT_CSR_OFFSET); ESRAM_AUTO_INIT_CSR_OFFSET);
unsigned int csr_val, times = 30; unsigned int csr_val;
int times = 30;
csr_val = ADF_CSR_RD(csr_addr, 0); csr_val = ADF_CSR_RD(csr_addr, 0);
if ((csr_val & ESRAM_AUTO_TINIT) && (csr_val & ESRAM_AUTO_TINIT_DONE)) if ((csr_val & ESRAM_AUTO_TINIT) && (csr_val & ESRAM_AUTO_TINIT_DONE))
...@@ -467,7 +468,7 @@ static int qat_hal_init_esram(struct icp_qat_fw_loader_handle *handle) ...@@ -467,7 +468,7 @@ static int qat_hal_init_esram(struct icp_qat_fw_loader_handle *handle)
qat_hal_wait_cycles(handle, 0, ESRAM_AUTO_INIT_USED_CYCLES, 0); qat_hal_wait_cycles(handle, 0, ESRAM_AUTO_INIT_USED_CYCLES, 0);
csr_val = ADF_CSR_RD(csr_addr, 0); csr_val = ADF_CSR_RD(csr_addr, 0);
} while (!(csr_val & ESRAM_AUTO_TINIT_DONE) && times--); } while (!(csr_val & ESRAM_AUTO_TINIT_DONE) && times--);
if ((!times)) { if ((times < 0)) {
pr_err("QAT: Fail to init eSram!\n"); pr_err("QAT: Fail to init eSram!\n");
return -EFAULT; return -EFAULT;
} }
...@@ -658,7 +659,7 @@ static int qat_hal_clear_gpr(struct icp_qat_fw_loader_handle *handle) ...@@ -658,7 +659,7 @@ static int qat_hal_clear_gpr(struct icp_qat_fw_loader_handle *handle)
ret = qat_hal_wait_cycles(handle, ae, 20, 1); ret = qat_hal_wait_cycles(handle, ae, 20, 1);
} while (ret && times--); } while (ret && times--);
if (!times) { if (times < 0) {
pr_err("QAT: clear GPR of AE %d failed", ae); pr_err("QAT: clear GPR of AE %d failed", ae);
return -EINVAL; return -EINVAL;
} }
......
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