All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Myeonghun Pak <mhun512@gmail.com>
Cc: Peter Huewe <peterhuewe@gmx.de>, Jason Gunthorpe <jgg@ziepe.ca>,
	linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ijae Kim <ae878000@gmail.com>
Subject: Re: [PATCH] tpm: tpm_i2c_nuvoton: disable IRQ on wait timeout
Date: Fri, 26 Jun 2026 19:31:05 +0300	[thread overview]
Message-ID: <aj6pSWaCs9yZ_nmY@kernel.org> (raw)
In-Reply-To: <20260626091653.54929-1-mhun512@gmail.com>

On Fri, Jun 26, 2026 at 06:16:53PM +0900, Myeonghun Pak wrote:
> i2c_nuvoton_wait_for_stat() enables the IRQ before waiting for the
> interrupt handler to report a status change. If the wait times out, or is
> interrupted before the handler runs, the function returns without
> balancing the enable_irq() call.
> 
> Disable the IRQ before leaving the failed wait path. Also preserve an
> interrupted wait's original error code instead of converting it to
> -ETIMEDOUT inside the helper.
> 
> Fixes: 4c336e4b1556 ("tpm: Add support for the Nuvoton NPCT501 I2C TPM")
> Co-developed-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
> ---
>  drivers/char/tpm/tpm_i2c_nuvoton.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
> index d44903b..aa36730 100644
> --- a/drivers/char/tpm/tpm_i2c_nuvoton.c
> +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
> @@ -182,8 +182,10 @@ static int i2c_nuvoton_wait_for_stat(struct tpm_chip *chip, u8 mask, u8 value,
>  						      timeout);
>  		if (rc > 0)
>  			return 0;
> -		/* At this point we know that the SINT pin is asserted, so we
> -		 * do not need to do i2c_nuvoton_check_status */
> +
> +		disable_irq(priv->irq);
> +		if (rc < 0)
> +			return rc;
>  	} else {
>  		unsigned long ten_msec, stop;
>  		bool status_valid;
> -- 
> 2.47.1

LGTM

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko

      reply	other threads:[~2026-06-26 16:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26  9:16 [PATCH] tpm: tpm_i2c_nuvoton: disable IRQ on wait timeout Myeonghun Pak
2026-06-26 16:31 ` Jarkko Sakkinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aj6pSWaCs9yZ_nmY@kernel.org \
    --to=jarkko@kernel.org \
    --cc=ae878000@gmail.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhun512@gmail.com \
    --cc=peterhuewe@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.