]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
tpm: print tpm2_commit_space() error inside tpm2_commit_space()
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Sat, 3 Nov 2018 16:36:38 +0000 (18:36 +0200)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Wed, 13 Feb 2019 07:47:31 +0000 (09:47 +0200)
The error logging for tpm2_commit_space() is in a wrong place. This
commit moves it inside that function.

Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Tested-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Reviewed-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Tested-by: Alexander Steffen <Alexander.Steffen@infineon.com>
drivers/char/tpm/tpm-interface.c
drivers/char/tpm/tpm2-space.c

index ec54f1677505ec297c0bf1652ff30751b2af5343..e48ed28562f403ee39d08f9392dc2a13b6cc4c1e 100644 (file)
@@ -286,8 +286,6 @@ out_recv:
        }
 
        rc = tpm2_commit_space(chip, space, ordinal, buf, &len);
-       if (rc)
-               dev_err(&chip->dev, "tpm2_commit_space: error %d\n", rc);
 
 out:
        /* may fail but do not override previous error value in rc */
index 1131a8e7b79ba76493cf4b3a7765e9dcc561708a..5ecc73988f7c01db56ba13c1aba49dd2149bc417 100644 (file)
@@ -501,19 +501,19 @@ int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space,
        rc = tpm2_map_response_header(chip, cc, buf, *bufsiz);
        if (rc) {
                tpm2_flush_space(chip);
-               return rc;
+               goto out;
        }
 
        rc = tpm2_map_response_body(chip, cc, buf, *bufsiz);
        if (rc) {
                tpm2_flush_space(chip);
-               return rc;
+               goto out;
        }
 
        rc = tpm2_save_space(chip);
        if (rc) {
                tpm2_flush_space(chip);
-               return rc;
+               goto out;
        }
 
        *bufsiz = be32_to_cpu(header->length);
@@ -526,4 +526,7 @@ int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space,
        memcpy(space->session_buf, chip->work_space.session_buf, PAGE_SIZE);
 
        return 0;
+out:
+       dev_err(&chip->dev, "%s: error %d\n", __func__, rc);
+       return rc;
 }