Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3407994ybb; Tue, 31 Mar 2020 04:47:05 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtmeYP8F7sl0/cIVST4cPg6vBY9yC+9i4lwayT5gGLcA1p4ftnmeq0ktHsFDNtzgeqYZOln X-Received: by 2002:a9d:728e:: with SMTP id t14mr8427531otj.63.1585655225251; Tue, 31 Mar 2020 04:47:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585655225; cv=none; d=google.com; s=arc-20160816; b=LcILKaElL2HerV1Jk6PvNvX1D1EUkw8z2LDFYwjUebnMMtrpO5ztr/sOWedZfb0RQQ 4mLMPL2DvrsL2fW9aAGMqgGjhF6ngcsSblA2JP/b/E7oZjKBsmSZWfwPaJwjoV5k9jv2 mTxHQxcyqkFb2sVzVNV/qF9fNMs3lAEv9Jl6oNQ1LZJPOiYZ3rtU04kgvT2UDwWVAHFf b/UoEMPLfL1+C3RlqYF4lk/adSNn4I8gT1El4VWWEbJ4a2vqBRd2EhCHW0d545g4TNc1 7qWcCq85BQN6XGBB79V/9C7Sv/3tdipBGRerwKuffwWW95IBq3UbS2PkAChapdDFwuUQ lCZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=udyBcPb0LY/+Zxvqm/6N66DKTeNHAXJWVXnUJI2+kDI=; b=WBnUBwQYN2O7xbKZPcgfqsXLosgzVBiGYtn1r4TQnECCEZ/LuPmXN2tS3lbldE21sz 5wGnmiQabUxM7jdDDKjl6dy8lewPMzR92QptZE1ZTkmugppK3lu5CGfqGDCnE09e8NZy QH6Ine5Bw6DED9XVl0c36Hq9WAo9HBDpHWm48yTnvMcXTKs9PjPrVZAGmmjS7zDoqKAs 5G1XiI7TMFhuxpoNHRsDo5mPpXDIKj504VL7NMGPP7+K4kYxCFyROKRKRCh5j5Ck09zw lDfGLRwbUp4DeMbfGiD1KvILZ1z6Hbnhbmw6V2R+EMvUfRYm9SLM33FYQLgpv7uKDrR4 LGfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j184si6941006oih.216.2020.03.31.04.46.52; Tue, 31 Mar 2020 04:47:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730729AbgCaLq3 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 31 Mar 2020 07:46:29 -0400 Received: from maillog.nuvoton.com ([202.39.227.15]:40908 "EHLO maillog.nuvoton.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730645AbgCaLq0 (ORCPT ); Tue, 31 Mar 2020 07:46:26 -0400 Received: from NTHCCAS02.nuvoton.com (nthccas02.nuvoton.com [10.1.8.29]) by maillog.nuvoton.com (Postfix) with ESMTP id 1E4EE1C80E4B; Tue, 31 Mar 2020 19:34:57 +0800 (CST) Received: from NTILML02.nuvoton.com (10.190.1.46) by NTHCCAS02.nuvoton.com (10.1.8.29) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Tue, 31 Mar 2020 19:34:56 +0800 Received: from NTILML02.nuvoton.com (10.190.1.47) by NTILML02.nuvoton.com (10.190.1.47) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Tue, 31 Mar 2020 14:34:54 +0300 Received: from taln70.nuvoton.co.il (10.191.1.70) by NTILML02.nuvoton.com (10.190.1.46) with Microsoft SMTP Server id 15.0.1130.7 via Frontend Transport; Tue, 31 Mar 2020 14:34:54 +0300 Received: from taln60.nuvoton.co.il (taln60 [10.191.1.180]) by taln70.nuvoton.co.il (Postfix) with ESMTP id 3A7EA250; Tue, 31 Mar 2020 14:34:54 +0300 (IDT) Received: by taln60.nuvoton.co.il (Postfix, from userid 10140) id 2CA4C639B0; Tue, 31 Mar 2020 14:34:24 +0300 (IDT) From: To: , , , , , , , , , CC: , , , , , , , , , , , Amir Mizinski Subject: [PATCH v4 3/7] tpm: tpm_tis: rewrite "tpm_tis_req_canceled()" Date: Tue, 31 Mar 2020 14:32:03 +0300 Message-ID: <20200331113207.107080-4-amirmizi6@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200331113207.107080-1-amirmizi6@gmail.com> References: <20200331113207.107080-1-amirmizi6@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Amir Mizinski Using this function while read/write data resulted in aborted operation. After investigating according to TCG TPM Profile (PTP) Specifications, i found cancel should happen only if TPM_STS.commandReady bit is lit and couldn't find a case when the current condition is valid. Also only cmdReady bit need to be compared instead of the full lower status register byte. Signed-off-by: Amir Mizinski --- drivers/char/tpm/tpm_tis_core.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index 6c4f232..18b9dc4 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -710,17 +710,7 @@ static int probe_itpm(struct tpm_chip *chip) static bool tpm_tis_req_canceled(struct tpm_chip *chip, u8 status) { - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - - switch (priv->manufacturer_id) { - case TPM_VID_WINBOND: - return ((status == TPM_STS_VALID) || - (status == (TPM_STS_VALID | TPM_STS_COMMAND_READY))); - case TPM_VID_STM: - return (status == (TPM_STS_VALID | TPM_STS_COMMAND_READY)); - default: - return (status == TPM_STS_COMMAND_READY); - } + return ((status & TPM_STS_COMMAND_READY) == TPM_STS_COMMAND_READY); } static irqreturn_t tis_int_handler(int dummy, void *dev_id) -- 2.7.4 =========================================================================================== The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.