From patchwork Wed Jan 6 09:53:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingchao Yang X-Patchwork-Id: 7965581 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E1BEABEEE5 for ; Wed, 6 Jan 2016 09:55:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1D6C52015E for ; Wed, 6 Jan 2016 09:55:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 64CC82013D for ; Wed, 6 Jan 2016 09:55:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752094AbcAFJzL (ORCPT ); Wed, 6 Jan 2016 04:55:11 -0500 Received: from mga04.intel.com ([192.55.52.120]:3127 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751985AbcAFJzJ (ORCPT ); Wed, 6 Jan 2016 04:55:09 -0500 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP; 06 Jan 2016 01:55:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,528,1444719600"; d="scan'208";a="628809717" Received: from unknown (HELO qat-server-112.sh.intel.com) ([10.239.129.138]) by FMSMGA003.fm.intel.com with ESMTP; 06 Jan 2016 01:53:17 -0800 From: Yang Pingchao To: herbert@gondor.apana.org.au Cc: tadeusz.struk@intel.com, linux-crypto@vger.kernel.org, qat-linux@intel.com, Yang Pingchao Subject: [PATCH] crypto: qat - fix timeout issues Date: Wed, 6 Jan 2016 17:53:15 +0800 Message-Id: <1452073995-114905-1-git-send-email-pingchao.yang@intel.com> X-Mailer: git-send-email 2.6.4 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Change the timeout conditon since the value of times should be -1 after loop. Signed-off-by: Yang Pingchao --- drivers/crypto/qat/qat_common/qat_hal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/qat/qat_common/qat_hal.c b/drivers/crypto/qat/qat_common/qat_hal.c index 0ac0ba8..0d0b5ed 100644 --- a/drivers/crypto/qat/qat_common/qat_hal.c +++ b/drivers/crypto/qat/qat_common/qat_hal.c @@ -402,7 +402,7 @@ static int qat_hal_check_ae_alive(struct icp_qat_fw_loader_handle *handle) cur_cnt &= 0xffff; } while (times-- && (cur_cnt == base_cnt)); - if (!times) { + if (times < 0) { pr_err("QAT: AE%d is inactive!!\n", ae); return -EFAULT; } @@ -467,7 +467,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); csr_val = ADF_CSR_RD(csr_addr, 0); } while (!(csr_val & ESRAM_AUTO_TINIT_DONE) && times--); - if ((!times)) { + if ((times < 0)) { pr_err("QAT: Fail to init eSram!\n"); return -EFAULT; } @@ -658,7 +658,7 @@ static int qat_hal_clear_gpr(struct icp_qat_fw_loader_handle *handle) ret = qat_hal_wait_cycles(handle, ae, 20, 1); } while (ret && times--); - if (!times) { + if (times < 0) { pr_err("QAT: clear GPR of AE %d failed", ae); return -EINVAL; }