Re: [PULL] TPM: MAINTAINERS contacts update and error report fix

From: Rajiv Andrade
Date: Mon May 07 2012 - 13:17:10 EST


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/