From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751491AbdBXM6j (ORCPT ); Fri, 24 Feb 2017 07:58:39 -0500 Received: from mga07.intel.com ([134.134.136.100]:4841 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751391AbdBXMzd (ORCPT ); Fri, 24 Feb 2017 07:55:33 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,201,1484035200"; d="scan'208";a="937678443" Date: Fri, 24 Feb 2017 14:55:24 +0200 From: Jarkko Sakkinen To: Peter Huewe Cc: Jason Gunthorpe , tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, peterhuewe@gmx.de, Christophe Ricard , stable@vger.kernel.org, Alexander Steffen Subject: Re: [PATCH 2/5] tpm_tis_spi: Abort transfer when too many wait states are signaled Message-ID: <20170224125524.kn2bgayymqvd5myz@intel.com> References: <1487261306-2494-1-git-send-email-peter.huewe@infineon.com> <1487261306-2494-3-git-send-email-peter.huewe@infineon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1487261306-2494-3-git-send-email-peter.huewe@infineon.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.6.2-neo (2016-08-21) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 16, 2017 at 04:08:23PM +0000, Peter Huewe wrote: > Abort the transfer with ETIMEDOUT when the TPM signals more than > TPM_RETRY wait states. Continuing with the transfer in this state > will only lead to arbitrary failures in other parts of the code. > > Cc: > Fixes: 0edbfea537d1 ("tpm/tpm_tis_spi: Add support for spi phy") > Signed-off-by: Alexander Steffen > Signed-off-by: Peter Huewe Reviewed-by: Jarkko Sakkinen /Jarkko > --- > drivers/char/tpm/tpm_tis_spi.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c > index 6e1a3c43f621..d782b9974c14 100644 > --- a/drivers/char/tpm/tpm_tis_spi.c > +++ b/drivers/char/tpm/tpm_tis_spi.c > @@ -101,6 +101,11 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u8 len, > goto exit; > } > > + if (i == TPM_RETRY) { > + ret = -ETIMEDOUT; > + goto exit; > + } > + > spi_xfer.cs_change = 0; > spi_xfer.len = len; > > -- > 2.7.4 >