From patchwork Fri May 1 13:21:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 226516 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D5E6C4724C for ; Fri, 1 May 2020 13:56:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4CF822054F for ; Fri, 1 May 2020 13:56:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588341367; bh=OP8WiCr8UK7BiBkW5BkjG12JCF/DOznvOiPbeV7myKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=exx+sD2RyvgMZmC7b2A5YS3sd2qB4FwQzWfgkAa2f6zKtEPl2ZBuqanub7gRA411t LwS7S/mdpJKtINnR5zroCCeFjqyCkRz0vFCep27jjrJcnmMeCRKcltL3fkqxU/IP1U MZmCmBp1L1QvPM6C1VFCW+j3xAt3zmrHaDs8a3eM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729796AbgEANdB (ORCPT ); Fri, 1 May 2020 09:33:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:58238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730366AbgEANdA (ORCPT ); Fri, 1 May 2020 09:33:00 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6F38A208C3; Fri, 1 May 2020 13:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588339979; bh=OP8WiCr8UK7BiBkW5BkjG12JCF/DOznvOiPbeV7myKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m8kzzx2oRXJO4ycEmecCr1G5hEvFjhsA23KdX46E1c4/E5/USdeFihX03IMSDz34K 1QrZitBp7UJhvwyXrORhFW9CsWmIFMAbolB4xGEEHRJiuk3Wa+Qs3uD8sBfF59d/Er mtWXMwScyumSQTJ3/LFXMWBILhQtMgX0zWU0t7eg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Jarkko Sakkinen Subject: [PATCH 4.14 057/117] tpm/tpm_tis: Free IRQ if probing fails Date: Fri, 1 May 2020 15:21:33 +0200 Message-Id: <20200501131552.384123088@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200501131544.291247695@linuxfoundation.org> References: <20200501131544.291247695@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jarkko Sakkinen commit b160c94be5d2816b62c8ac338605668304242959 upstream. Call disable_interrupts() if we have to revert to polling in order not to unnecessarily reserve the IRQ for the life-cycle of the driver. Cc: stable@vger.kernel.org # 4.5.x Reported-by: Hans de Goede Fixes: e3837e74a06d ("tpm_tis: Refactor the interrupt setup") Signed-off-by: Jarkko Sakkinen Signed-off-by: Greg Kroah-Hartman --- drivers/char/tpm/tpm_tis_core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -331,6 +331,9 @@ static void disable_interrupts(struct tp u32 intmask; int rc; + if (priv->irq == 0) + return; + rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask); if (rc < 0) intmask = 0; @@ -874,9 +877,12 @@ int tpm_tis_core_init(struct device *dev if (irq) { tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED, irq); - if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) + if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) { dev_err(&chip->dev, FW_BUG "TPM interrupt not working, polling instead\n"); + + disable_interrupts(chip); + } } else { tpm_tis_probe_irq(chip, intmask); }