From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752771AbdBQFEp (ORCPT ); Fri, 17 Feb 2017 00:04:45 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34186 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750752AbdBQFEn (ORCPT ); Fri, 17 Feb 2017 00:04:43 -0500 Subject: Re: [PATCH 2/5] tpm_tis_spi: Abort transfer when too many wait states are signaled To: Peter Huewe , Jarkko Sakkinen References: <1487261306-2494-1-git-send-email-peter.huewe@infineon.com> <1487261306-2494-3-git-send-email-peter.huewe@infineon.com> Cc: Jason Gunthorpe , tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, peterhuewe@gmx.de, Christophe Ricard , stable@vger.kernel.org, Alexander Steffen From: Christophe Ricard Message-ID: Date: Thu, 16 Feb 2017 21:04:40 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <1487261306-2494-3-git-send-email-peter.huewe@infineon.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Nitpick: Are you sure this patch is necessary having #3 on top of it ? On 16/02/2017 08:08, 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 > --- > 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; >