Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2624905rwd; Mon, 22 May 2023 01:33:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ41xdIDaS2Sa3mCWiI5UnC9eHKuo0HZP9i2f6NbvUiKsYio8Jvm0jB5z3QiNNZXOg8aEj3h X-Received: by 2002:a17:902:e74a:b0:1ae:f37:c1ab with SMTP id p10-20020a170902e74a00b001ae0f37c1abmr12174691plf.25.1684744411082; Mon, 22 May 2023 01:33:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684744411; cv=none; d=google.com; s=arc-20160816; b=nv9zLg1JC4Inos0PCLHvgSuD5swz2b71FK/+wVNt5/IyPiTF9kvqypbcRxDZ/5zcEt 0pHSqVJUNMo8CN8aVlacrhx9kFKcWhWSauW06ooSzWy1BQXwCLXj0AqIJbke1lSmWe5y ahEfP2G6pDZHcmuk4vclpd6liPqaeZq+cvAbDzZcPAOjL0uqv4vRrzsJas+D3QDp6MZt AWXogsHcQpQct+7/KYYQdRp0vkweUDH4pO1U0yoL6rgT3WBaTIpQVq0uoYsS/77ZjUQe i7qE/tWKXw1dQrp1maKLbs/+B7viySG71khCxLZOJaFW9O2hoqihaKjmO8RiY2xORxUe eQ3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=U8vMFspKfNBSG4aHdiRcqSNWtjtUp4geEeE73q21WbY=; b=Ou65nzi9MwfKkcgI8V9E/lEehP+VHoru//gqyTjlWpXcM4F1uF6Qi2OnHC5AhrE22l 9ZdvCV2QtCI/z+gB/yKyuyoiP6uN6bCUvtGfG4mQnEtadAjmZMSUaxqGnGZ1B2ikCfHN hnuFq8FCMJH/TIcmtvxyP7le/WEAIM47jPhhAQACX0rN9TrT2no6FNLx8BznYQ19Fpnq 9WeBxpRwalbw8OAD/nQCaMLLt1L9qSlIjCM+DZv+XcVXbuRwkZJleVoCt8OnT6owjCR/ 3CzfwI1IWzWdbnRwtyB7cOobxU01E1RlkDHcWbG5B8pgVPcyP3byAi0rjZpIpN4cwUIi Kj5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c8-20020a17090a1d0800b0024e0254d807si6811760pjd.143.2023.05.22.01.33.19; Mon, 22 May 2023 01:33:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232052AbjEVISP (ORCPT + 99 others); Mon, 22 May 2023 04:18:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbjEVISO (ORCPT ); Mon, 22 May 2023 04:18:14 -0400 Received: from mx3.molgen.mpg.de (mx3.molgen.mpg.de [141.14.17.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 753B3B4; Mon, 22 May 2023 01:18:12 -0700 (PDT) Received: from [192.168.0.2] (ip5f5aecf5.dynamic.kabel-deutschland.de [95.90.236.245]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id 0AC9B61E4052B; Mon, 22 May 2023 10:17:46 +0200 (CEST) Message-ID: <7840f8c2-a903-7d80-c4bd-8568ad1c8682@molgen.mpg.de> Date: Mon, 22 May 2023 10:17:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v2] tpm_tis_spi: fix:release chip select when flow control fails Content-Language: en-US To: Peijie Shao Cc: jarkko@kernel.org, peterhuewe@gmx.de, jgg@ziepe.ca, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230522070140.33719-1-shaopeijie@cestc.cn> From: Paul Menzel In-Reply-To: <20230522070140.33719-1-shaopeijie@cestc.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear Peijie, Thank you for your patch. The fix: tag in your commit message summary is uncommon. I suggest: > tpm_tis_spi: Release chip select when flow control fails Am 22.05.23 um 09:01 schrieb shaopeijie@cestc.cn: > From: Peijie Shao > > The failure paths in tpm_tis_spi_transfer() do not deactivate > chip select. Send an empty message (cs_select == 0) to overcome > this. Does the standard require to deactivate it? A note on your test setup would be nice to have in the commit message. > Signed-off-by: Peijie Shao > --- > Changes since v1: > 1. Deactive cs all of the failure path, not only flow control. Deactivate Kind regards, Paul > 2. change and update comments. > --- > drivers/char/tpm/tpm_tis_spi_main.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/char/tpm/tpm_tis_spi_main.c b/drivers/char/tpm/tpm_tis_spi_main.c > index 1f5207974..9bfaba092 100644 > --- a/drivers/char/tpm/tpm_tis_spi_main.c > +++ b/drivers/char/tpm/tpm_tis_spi_main.c > @@ -136,6 +136,14 @@ int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len, > } > > exit: > + if (ret < 0) { > + /* Deactivate chip select */ > + memset(&spi_xfer, 0, sizeof(spi_xfer)); > + spi_message_init(&m); > + spi_message_add_tail(&spi_xfer, &m); > + spi_sync_locked(phy->spi_device, &m); > + } > + > spi_bus_unlock(phy->spi_device->master); > return ret; > }