public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "Stefan Wahren" <wahrenst@gmx.net>,
	"Peter Huewe" <peterhuewe@gmx.de>,
	"Jason Gunthorpe" <jgg@ziepe.ca>
Cc: <linux-integrity@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"Stefan Berger" <stefanb@linux.ibm.com>
Subject: Re: [PATCH RFC 2/2] tpm: tpm_tis: Provide error messages in tpm_tis_core_init
Date: Fri, 06 Sep 2024 12:50:00 +0300	[thread overview]
Message-ID: <D3Z3W2PZDU7C.4CBZUBZYY0RS@kernel.org> (raw)
In-Reply-To: <20240906060947.4844-3-wahrenst@gmx.net>

On Fri Sep 6, 2024 at 9:09 AM EEST, Stefan Wahren wrote:
> In case of SPI wiring issues (e.g. MISO pin permanent high) the
> core init won't provide any error message on failure. Add some
> helpful error messages to tpm_tis_core_init(), which helps
> to better understand why the driver won't probe.
>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---
>  drivers/char/tpm/tpm_tis_core.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index fdef214b9f6b..830e331fcebe 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -1133,8 +1133,10 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
>  	dev_set_drvdata(&chip->dev, priv);
>
>  	rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor);
> -	if (rc < 0)
> +	if (rc < 0) {
> +		dev_err(dev, "Failed to read TPM_DID_VID register: %d\n", rc);
>  		return rc;
> +	}
>
>  	priv->manufacturer_id = vendor;
>
> @@ -1162,19 +1164,25 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
>  		chip->ops->clk_enable(chip, true);
>
>  	if (wait_startup(chip, 0) != 0) {
> +		dev_err(dev, "TPM device not accessible (0x%0x)\n",
> +			vendor);
>  		rc = -ENODEV;
>  		goto out_err;
>  	}
>
>  	/* Take control of the TPM's interrupt hardware and shut it off */
>  	rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask);
> -	if (rc < 0)
> +	if (rc < 0) {
> +		dev_err(dev, "Failed to read TPM_INT_ENABLE register: %d\n", rc);
>  		goto out_err;
> +	}
>
>  	/* Figure out the capabilities */
>  	rc = tpm_tis_read32(priv, TPM_INTF_CAPS(priv->locality), &intfcaps);
> -	if (rc < 0)
> +	if (rc < 0) {
> +		dev_err(dev, "Failed to read TPM_INTF_CAPS register: %d\n", rc);
>  		goto out_err;
> +	}
>
>  	dev_dbg(dev, "TPM interface capabilities (0x%x):\n",
>  		intfcaps);
> @@ -1209,6 +1217,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
>
>  	rc = tpm_tis_request_locality(chip, 0);
>  	if (rc < 0) {
> +		dev_err(dev, "Failed to request locality (0x%0x)\n", vendor);
>  		rc = -ENODEV;
>  		goto out_err;
>  	}
> --
> 2.34.1

No thanks. It not only adds helpful messages but has potential to add
unwanted merge conflicts.

BR, Jarkko

  reply	other threads:[~2024-09-06  9:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06  6:09 [PATCH RFC 0/2] tpm: Minor improvements Stefan Wahren
2024-09-06  6:09 ` [PATCH RFC 1/2] tpm: tpm_tis_spi: Ensure SPI mode 0 Stefan Wahren
2024-09-06  9:47   ` Jarkko Sakkinen
2024-09-06 14:46     ` Stefan Wahren
2024-09-09 17:05       ` Jarkko Sakkinen
2024-09-09 17:16         ` Stefan Wahren
2024-09-06  6:09 ` [PATCH RFC 2/2] tpm: tpm_tis: Provide error messages in tpm_tis_core_init Stefan Wahren
2024-09-06  9:50   ` Jarkko Sakkinen [this message]
2024-09-06 14:42     ` Stefan Wahren

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=D3Z3W2PZDU7C.4CBZUBZYY0RS@kernel.org \
    --to=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=stefanb@linux.ibm.com \
    --cc=wahrenst@gmx.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox