From: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
To: Joe Perches <joe@perches.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: Mon, 07 May 2012 14:16:44 -0300 [thread overview]
Message-ID: <4FA8037C.8010304@linux.vnet.ibm.com> (raw)
In-Reply-To: <1336076080.13866.49.camel@joe2Laptop>
On 03/05/12 17:14, Joe Perches wrote:
> 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.
Yep.. I missed it.
>
>> +
>> 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...
>
>
Thanks for pointing.
James, please ignore, I'll send a better version of this fix.
Rajiv
prev parent reply other threads:[~2012-05-07 17:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-03 17:10 [PULL] TPM: MAINTAINERS contacts update and error report fix Rajiv Andrade
2012-05-03 20:14 ` Joe Perches
2012-05-07 17:16 ` Rajiv Andrade [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=4FA8037C.8010304@linux.vnet.ibm.com \
--to=srajiv@linux.vnet.ibm.com \
--cc=jmorris@namei.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pebolle@tiscali.nl \
--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