diff options
Diffstat (limited to 'drivers/char/tpm/tpm.c')
-rw-r--r-- | drivers/char/tpm/tpm.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index efd24bbb5cb1..67335af0ec2a 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -438,7 +438,6 @@ out: | |||
438 | } | 438 | } |
439 | 439 | ||
440 | #define TPM_DIGEST_SIZE 20 | 440 | #define TPM_DIGEST_SIZE 20 |
441 | #define TPM_ERROR_SIZE 10 | ||
442 | #define TPM_RET_CODE_IDX 6 | 441 | #define TPM_RET_CODE_IDX 6 |
443 | 442 | ||
444 | enum tpm_capabilities { | 443 | enum tpm_capabilities { |
@@ -467,12 +466,14 @@ static ssize_t transmit_cmd(struct tpm_chip *chip, struct tpm_cmd_t *cmd, | |||
467 | len = tpm_transmit(chip,(u8 *) cmd, len); | 466 | len = tpm_transmit(chip,(u8 *) cmd, len); |
468 | if (len < 0) | 467 | if (len < 0) |
469 | return len; | 468 | return len; |
470 | if (len == TPM_ERROR_SIZE) { | 469 | else if (len < TPM_HEADER_SIZE) |
471 | err = be32_to_cpu(cmd->header.out.return_code); | 470 | return -EFAULT; |
472 | dev_dbg(chip->dev, "A TPM error (%d) occurred %s\n", err, desc); | 471 | |
473 | return err; | 472 | err = be32_to_cpu(cmd->header.out.return_code); |
474 | } | 473 | if (err != 0) |
475 | return 0; | 474 | dev_err(chip->dev, "A TPM error (%d) occurred %s\n", err, desc); |
475 | |||
476 | return err; | ||
476 | } | 477 | } |
477 | 478 | ||
478 | #define TPM_INTERNAL_RESULT_SIZE 200 | 479 | #define TPM_INTERNAL_RESULT_SIZE 200 |