]> git.karo-electronics.de Git - linux-beck.git/commitdiff
tpm: Have tpm_get_timeouts return an error code
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Fri, 11 Nov 2011 17:57:02 +0000 (12:57 -0500)
committerRajiv Andrade <srajiv@linux.vnet.ibm.com>
Wed, 16 Nov 2011 11:42:54 +0000 (09:42 -0200)
Have the tpm_get_timeouts function return an error code.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
drivers/char/tpm/tpm.c
drivers/char/tpm/tpm.h

index e53af7638186840d449a65de533667dbb164316c..b6c4a320cfde4c39618d489606237200943e7df0 100644 (file)
@@ -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;
@@ -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 */
@@ -580,12 +580,12 @@ duration:
        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] =
@@ -607,6 +607,7 @@ duration:
                chip->vendor.duration_adjusted = true;
                dev_info(chip->dev, "Adjusting TPM timeout parameters.");
        }
+       return 0;
 }
 EXPORT_SYMBOL_GPL(tpm_get_timeouts);
 
index 9c4163cfa3ce94ab230ff3b9a58d568206634561..4747b68c0c1b90305fec0a889dc94e8c9b92db9e 100644 (file)
@@ -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);