Skip to content

Commit

Permalink
tpm: Have tpm_get_timeouts return an error code
Browse files Browse the repository at this point in the history
Have the tpm_get_timeouts function return an error code.

Signed-off-by: Stefan Berger <[email protected]>
  • Loading branch information
stefanberger authored and srajiv committed Nov 16, 2011
1 parent e163bc8 commit 2b30a90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions drivers/char/tpm/tpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ void tpm_gen_interrupt(struct tpm_chip *chip)
}
EXPORT_SYMBOL_GPL(tpm_gen_interrupt);

void tpm_get_timeouts(struct tpm_chip *chip)
int tpm_get_timeouts(struct tpm_chip *chip)
{
struct tpm_cmd_t tpm_cmd;
struct timeout_t *timeout_cap;
Expand All @@ -549,7 +549,7 @@ void tpm_get_timeouts(struct tpm_chip *chip)
if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 ||
be32_to_cpu(tpm_cmd.header.out.length)
!= sizeof(tpm_cmd.header.out) + sizeof(u32) + 4 * sizeof(u32))
return;
return -EINVAL;

timeout_cap = &tpm_cmd.params.getcap_out.cap.timeout;
/* Don't overwrite default if value is 0 */
Expand Down Expand Up @@ -580,12 +580,12 @@ void tpm_get_timeouts(struct tpm_chip *chip)
rc = transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE,
"attempting to determine the durations");
if (rc)
return;
return rc;

if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 ||
be32_to_cpu(tpm_cmd.header.out.length)
!= sizeof(tpm_cmd.header.out) + sizeof(u32) + 3 * sizeof(u32))
return;
return -EINVAL;

duration_cap = &tpm_cmd.params.getcap_out.cap.duration;
chip->vendor.duration[TPM_SHORT] =
Expand All @@ -607,6 +607,7 @@ void tpm_get_timeouts(struct tpm_chip *chip)
chip->vendor.duration_adjusted = true;
dev_info(chip->dev, "Adjusting TPM timeout parameters.");
}
return 0;
}
EXPORT_SYMBOL_GPL(tpm_get_timeouts);

Expand Down
2 changes: 1 addition & 1 deletion drivers/char/tpm/tpm.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ struct tpm_cmd_t {

ssize_t tpm_getcap(struct device *, __be32, cap_t *, const char *);

extern void tpm_get_timeouts(struct tpm_chip *);
extern int tpm_get_timeouts(struct tpm_chip *);
extern void tpm_gen_interrupt(struct tpm_chip *);
extern void tpm_continue_selftest(struct tpm_chip *);
extern unsigned long tpm_calc_ordinal_duration(struct tpm_chip *, u32);
Expand Down

0 comments on commit 2b30a90

Please sign in to comment.