tpm: invalid self test error message
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Thu, 1 Sep 2016 23:36:58 +0000 (02:36 +0300)
committerJames Morris <james.l.morris@oracle.com>
Fri, 2 Sep 2016 22:27:37 +0000 (08:27 +1000)
The driver emits invalid self test error message even though the init
succeeds.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Fixes: cae8b441fc20 ("tpm: Factor out common startup code")
Reviewed-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
drivers/char/tpm/tpm2-cmd.c

index 08c7e23..0c75c3f 100644 (file)
@@ -957,7 +957,7 @@ int tpm2_auto_startup(struct tpm_chip *chip)
                goto out;
 
        rc = tpm2_do_selftest(chip);
-       if (rc != TPM2_RC_INITIALIZE) {
+       if (rc != 0 && rc != TPM2_RC_INITIALIZE) {
                dev_err(&chip->dev, "TPM self test failed\n");
                goto out;
        }
@@ -974,7 +974,6 @@ int tpm2_auto_startup(struct tpm_chip *chip)
                }
        }
 
-       return rc;
 out:
        if (rc > 0)
                rc = -ENODEV;