From patchwork Tue Dec 15 10:05:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 7853081 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 27DBEBEEE1 for ; Tue, 15 Dec 2015 10:05:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5C69D2025B for ; Tue, 15 Dec 2015 10:05:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7028A2025A for ; Tue, 15 Dec 2015 10:05:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964889AbbLOKFh (ORCPT ); Tue, 15 Dec 2015 05:05:37 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:45392 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964816AbbLOKFd (ORCPT ); Tue, 15 Dec 2015 05:05:33 -0500 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id tBFA5OEU008874 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 15 Dec 2015 10:05:25 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id tBFA5NBV011300 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 15 Dec 2015 10:05:23 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id tBFA5NJ2029291; Tue, 15 Dec 2015 10:05:23 GMT Received: from mwanda (/154.0.139.178) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 15 Dec 2015 02:05:23 -0800 Date: Tue, 15 Dec 2015 13:05:15 +0300 From: Dan Carpenter To: Tadeusz Struk Cc: Herbert Xu , "David S. Miller" , Bruce Allan , Pingchao Yang , qat-linux@intel.com, linux-crypto@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] crypto: qat - fix some timeout tests Message-ID: <20151215100515.GB20848@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Source-IP: aserv0022.oracle.com [141.146.126.234] 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, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 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 --- This means we only loop 9999 times instead of 10000 like before but I figure it probably doesn't matter. -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);