Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1590335ybl; Mon, 2 Dec 2019 05:39:43 -0800 (PST) X-Google-Smtp-Source: APXvYqz2o6kebtYgIPUkanTsj2ph+GwRMbp8VJOdUHLgy1JjAF+wOy5SvMV6nzWbedeevR5bsNUe X-Received: by 2002:a1c:7c06:: with SMTP id x6mr29698274wmc.34.1575293983481; Mon, 02 Dec 2019 05:39:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575293983; cv=none; d=google.com; s=arc-20160816; b=FVDUe4gmMAPBL11f7cNq3LYH1f+pGL4SC/9/g9R3X9+tYUlH4yTo5fgjfFTQgVk9Ba cZNr4SJEUxLw5umC1WRWn4J4nREfrZXLjbY4oPrEWAkIVRBJ/CUaFNy0kD/HKaFOXs79 r7R4Js8wVELuvWvM3CD6nY55AOhh4xXSVTxF2tkceR7jn7haTV2QC8U6VE18NauoDFUw jJw+pXsflHMfLDAM/5vwg5zeU2WfC00hRfoTIno5gWOScaTYvE2Yjdl5iMsF/R2wJolN Qqc+03KxtNOxrs4PW9FEz+M/ElsSKzPGRWJ2dNCcptq9P6L6JJDgk+j3cbjNozupxOdN O4mg== 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=HRNApMX4yweVjQjmcWilOlkpmXa5fsjTQrvp8fn5aWQ=; b=Q2r6pMAqpXs+N3ufruAK0BPOs8SM3Awu4RDn9PY/z1QLdXusyEFr7oyUybPj5xh1Lk IMK1oI+tdHjsXKTV8uBieORarn+GJpY16ueiCNX3PT05ox/d76fu5i621ps0J9okYrgp CIENNEJZU1yIVufpSz6lnXv8DBXvk5r07skBLSBHrP81YQlntuVhYTuR++jVZ3CMTtXc uql37clTpDjVI+20ildNZIH7yye6bDF8Ecbd3S/68V1846Jy6iIDkGOUD2XM07I8BQQ3 PuRhlD92c93GYYLcSUvagJ0I0eOPpau8cNMVuJtpRf09aV3cEr9Sl9syaIJc7hPaSdE8 I+9A== 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 f5si3930674edx.311.2019.12.02.05.39.19; Mon, 02 Dec 2019 05:39:43 -0800 (PST) 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 S1727530AbfLBNeq (ORCPT + 99 others); Mon, 2 Dec 2019 08:34:46 -0500 Received: from 212.199.177.27.static.012.net.il ([212.199.177.27]:45895 "EHLO herzl.nuvoton.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727503AbfLBNeq (ORCPT ); Mon, 2 Dec 2019 08:34:46 -0500 Received: from taln60.nuvoton.co.il (ntil-fw [212.199.177.25]) by herzl.nuvoton.co.il (8.13.8/8.13.8) with ESMTP id xB2DYIxY015796; Mon, 2 Dec 2019 15:34:18 +0200 Received: by taln60.nuvoton.co.il (Postfix, from userid 10140) id BD0986032E; Mon, 2 Dec 2019 15:34:18 +0200 (IST) From: amirmizi6@gmail.com To: Eyal.Cohen@nuvoton.com, jarkko.sakkinen@linux.intel.com, oshrialkoby85@gmail.com, alexander.steffen@infineon.com, robh+dt@kernel.org, mark.rutland@arm.com, peterhuewe@gmx.de, jgg@ziepe.ca, arnd@arndb.de, gregkh@linuxfoundation.org Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, oshri.alkoby@nuvoton.com, tmaimon77@gmail.com, gcwilson@us.ibm.com, kgoldman@us.ibm.com, ayna@linux.vnet.ibm.com, Dan.Morav@nuvoton.com, oren.tanami@nuvoton.com, shmulik.hager@nuvoton.com, amir.mizinski@nuvoton.com, Amir Mizinski Subject: [PATCH v2 3/5] char: tpm: rewrite "tpm_tis_req_canceled()" Date: Mon, 2 Dec 2019 15:33:30 +0200 Message-Id: <20191202133332.178110-4-amirmizi6@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20191202133332.178110-1-amirmizi6@gmail.com> References: <20191202133332.178110-1-amirmizi6@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 43784fd..924489c 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -631,17 +631,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