diff options
author | Stefan Berger <stefanb@linux.vnet.ibm.com> | 2011-11-11 12:57:02 -0500 |
---|---|---|
committer | Rajiv Andrade <srajiv@linux.vnet.ibm.com> | 2011-11-16 06:42:54 -0500 |
commit | 2b30a90f6c358714b9d6e628ac92e514917f93a1 (patch) | |
tree | d5fee00222aea732edd6760eb5fe78675e5dc2e2 /drivers/char/tpm/tpm.c | |
parent | e163bc8e4a0cd1cdffadb58253f7651201722d56 (diff) |
tpm: Have tpm_get_timeouts return an error code
Have the tpm_get_timeouts function return an error code.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Diffstat (limited to 'drivers/char/tpm/tpm.c')
-rw-r--r-- | drivers/char/tpm/tpm.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index e53af7638186..b6c4a320cfde 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -527,7 +527,7 @@ void tpm_gen_interrupt(struct tpm_chip *chip) | |||
527 | } | 527 | } |
528 | EXPORT_SYMBOL_GPL(tpm_gen_interrupt); | 528 | EXPORT_SYMBOL_GPL(tpm_gen_interrupt); |
529 | 529 | ||
530 | void tpm_get_timeouts(struct tpm_chip *chip) | 530 | int tpm_get_timeouts(struct tpm_chip *chip) |
531 | { | 531 | { |
532 | struct tpm_cmd_t tpm_cmd; | 532 | struct tpm_cmd_t tpm_cmd; |
533 | struct timeout_t *timeout_cap; | 533 | struct timeout_t *timeout_cap; |
@@ -549,7 +549,7 @@ void tpm_get_timeouts(struct tpm_chip *chip) | |||
549 | if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 || | 549 | if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 || |
550 | be32_to_cpu(tpm_cmd.header.out.length) | 550 | be32_to_cpu(tpm_cmd.header.out.length) |
551 | != sizeof(tpm_cmd.header.out) + sizeof(u32) + 4 * sizeof(u32)) | 551 | != sizeof(tpm_cmd.header.out) + sizeof(u32) + 4 * sizeof(u32)) |
552 | return; | 552 | return -EINVAL; |
553 | 553 | ||
554 | timeout_cap = &tpm_cmd.params.getcap_out.cap.timeout; | 554 | timeout_cap = &tpm_cmd.params.getcap_out.cap.timeout; |
555 | /* Don't overwrite default if value is 0 */ | 555 | /* Don't overwrite default if value is 0 */ |
@@ -580,12 +580,12 @@ duration: | |||
580 | rc = transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE, | 580 | rc = transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE, |
581 | "attempting to determine the durations"); | 581 | "attempting to determine the durations"); |
582 | if (rc) | 582 | if (rc) |
583 | return; | 583 | return rc; |
584 | 584 | ||
585 | if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 || | 585 | if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 || |
586 | be32_to_cpu(tpm_cmd.header.out.length) | 586 | be32_to_cpu(tpm_cmd.header.out.length) |
587 | != sizeof(tpm_cmd.header.out) + sizeof(u32) + 3 * sizeof(u32)) | 587 | != sizeof(tpm_cmd.header.out) + sizeof(u32) + 3 * sizeof(u32)) |
588 | return; | 588 | return -EINVAL; |
589 | 589 | ||
590 | duration_cap = &tpm_cmd.params.getcap_out.cap.duration; | 590 | duration_cap = &tpm_cmd.params.getcap_out.cap.duration; |
591 | chip->vendor.duration[TPM_SHORT] = | 591 | chip->vendor.duration[TPM_SHORT] = |
@@ -607,6 +607,7 @@ duration: | |||
607 | chip->vendor.duration_adjusted = true; | 607 | chip->vendor.duration_adjusted = true; |
608 | dev_info(chip->dev, "Adjusting TPM timeout parameters."); | 608 | dev_info(chip->dev, "Adjusting TPM timeout parameters."); |
609 | } | 609 | } |
610 | return 0; | ||
610 | } | 611 | } |
611 | EXPORT_SYMBOL_GPL(tpm_get_timeouts); | 612 | EXPORT_SYMBOL_GPL(tpm_get_timeouts); |
612 | 613 | ||