On Thu, 2012-05-03 at 14:10 -0300, Rajiv Andrade wrote:Yep.. I missed it.The first as the subject implies is just a contacts update, and the secondtrivia:
makes the driver avoid to mistakenly report the disabled and deactivated TPM
states as an error.
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)The else shouldn't be used here.
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);
Indented code followed by an unindented test is not nice.
Thanks for pointing.
+A more kernel style conformant style looks like:
if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) {
dev_info(chip->dev,
"TPM is disabled/deactivated (0x%X)\n", rc);
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...