# Re: \[PATCH\] tpm: WARN\_ONCE() -\> pr\_warn\_once() in tpm\_tis\_status()

- From: Jarkko Sakkinen \<jarkko@kernel.org\>
- Date: 2021-02-02 22:27:53 
- List: linux-integrity
- Page: https://ratatoskr.run/linux-integrity/2021/02/6871582
- Thread: https://ratatoskr.run/linux-integrity/2021/02/6871544/t.md

```text
On Tue, Feb 02, 2021 at 12:46:15PM -0400, Jason Gunthorpe wrote:
> On Tue, Feb 02, 2021 at 05:33:17PM +0200, jarkko@kernel.org wrote:
> > From: Jarkko Sakkinen <jarkko@kernel.org>
> > 
> > An unexpected status from TPM chip is not irrecovable failure of the
> > kernel. It's only undesirable situation. Thus, change the WARN_ONCE
> > instance inside tpm_tis_status() to pr_warn_once().
> > 
> > In addition: print the status in the log message because it is actually
> > useful information lacking from the existing log message.
> > 
> > Suggested-by:  Guenter Roeck <linux@roeck-us.net>
> > Cc: <redacted>
> > Fixes: 6f4f57f0b909 ("tpm: ibmvtpm: fix error return code in tpm_ibmvtpm_probe()")
> > Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
> >  drivers/char/tpm/tpm_tis_core.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> > index 431919d5f48a..21f67c6366cb 100644
> > +++ b/drivers/char/tpm/tpm_tis_core.c
> > @@ -202,7 +202,7 @@ static u8 tpm_tis_status(struct tpm_chip *chip)
> >  		 * acquired.  Usually because tpm_try_get_ops() hasn't
> >  		 * been called before doing a TPM operation.
> >  		 */
> > -		WARN_ONCE(1, "TPM returned invalid status\n");
> > +		pr_warn_once("TPM returned invalid status: 0x%x\n", status);
> 
> Use dev_warn_once since we have a chip->dev here
> 
> Jason

Right obviously that one is best to be preferred. I'll do that. Thanks.

/Jarkko
```
