mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Cc: jmorris@namei.org, pebolle@tiscali.nl,
	linux-kernel@vger.kernel.org, tpmdd@selhorst.net
Subject: Re: [PULL] TPM: MAINTAINERS contacts update and error report fix
Date: Thu, 03 May 2012 13:14:40 -0700	[thread overview]
Message-ID: <1336076080.13866.49.camel@joe2Laptop> (raw)
In-Reply-To: <20120503171054.GA6165@localhost.br.ibm.com>

On Thu, 2012-05-03 at 14:10 -0300, Rajiv Andrade wrote:
> The first as the subject implies is just a contacts update, and the second
> makes the driver avoid to mistakenly report the disabled and deactivated TPM
> states as an error.

trivia:

> diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
[]
> @@ -845,7 +845,16 @@ int tpm_do_selftest(struct tpm_chip *chip)
>  		return rc;
>  
>  	do {
> -		rc = __tpm_pcr_read(chip, 0, digest);
> +		/* Attempt to read a PCR value */
> +		cmd.header.in = pcrread_header;
> +		cmd.params.pcrread_in.pcr_idx = cpu_to_be32(0);
> +		rc = tpm_transmit(chip, (u8 *) &cmd, READ_PCR_RESULT_SIZE);
> +
> +		if (rc < TPM_HEADER_SIZE)
> +			return -EFAULT;
> +		else
> +			rc = be32_to_cpu(cmd.header.out.return_code);

The else shouldn't be used here.
Indented code followed by an unindented test is not nice.

> +
>  		if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) {
>  			dev_info(chip->dev,
>  				 "TPM is disabled/deactivated (0x%X)\n", rc);

A more kernel style conformant style looks like:

		rc = tpm_transmit(chip, (u8 *)&cmd, READ_PCR_RESULT_SIZE);
		if (rc < TPM_HEADER_SIZE)
			return -EFAULT;

		rc = be32_to_cpu(cmd.header.out.return_code);
 		if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) {
			etc...



  reply	other threads:[~2012-05-03 20:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-03 17:10 Rajiv Andrade
2012-05-03 20:14 ` Joe Perches [this message]
2012-05-07 17:16   ` Rajiv Andrade

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=1336076080.13866.49.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pebolle@tiscali.nl \
    --cc=srajiv@linux.vnet.ibm.com \
    --cc=tpmdd@selhorst.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

Powered by JetHome