+ rc = tpm_transmit_cmd(chip, NULL, buf.data, PAGE_SIZE, 0, 0, NULL);Why is this if() check not directly after the tpm_transmit_cmd() call that sets rc? Is it correct you want to destroy buf regardless of the tpm_transmit_cmd() outcome?
+ tpm_buf_destroy(&buf);
if (rc < 0)
return rc;
-
- if (be16_to_cpu(cmd.header.out.tag) == TPM2_ST_NO_SESSIONS)
+ out = (struct tpm_output_header *)buf.data;
+ if (be16_to_cpu(out->tag) == TPM2_ST_NO_SESSIONS)Thanks,
chip->flags |= TPM_CHIP_FLAG_TPM2;
return 0;