Skip to content

Commit aff0c20

Browse files
author
Jarkko Sakkinen
committed
tpm: print tpm2_commit_space() error inside tpm2_commit_space()
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>
1 parent 4148467 commit aff0c20

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

drivers/char/tpm/tpm-interface.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,6 @@ static ssize_t tpm_try_transmit(struct tpm_chip *chip,
286286
}
287287

288288
rc = tpm2_commit_space(chip, space, ordinal, buf, &len);
289-
if (rc)
290-
dev_err(&chip->dev, "tpm2_commit_space: error %d\n", rc);
291289

292290
out:
293291
/* may fail but do not override previous error value in rc */

drivers/char/tpm/tpm2-space.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,19 +501,19 @@ int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space,
501501
rc = tpm2_map_response_header(chip, cc, buf, *bufsiz);
502502
if (rc) {
503503
tpm2_flush_space(chip);
504-
return rc;
504+
goto out;
505505
}
506506

507507
rc = tpm2_map_response_body(chip, cc, buf, *bufsiz);
508508
if (rc) {
509509
tpm2_flush_space(chip);
510-
return rc;
510+
goto out;
511511
}
512512

513513
rc = tpm2_save_space(chip);
514514
if (rc) {
515515
tpm2_flush_space(chip);
516-
return rc;
516+
goto out;
517517
}
518518

519519
*bufsiz = be32_to_cpu(header->length);
@@ -526,4 +526,7 @@ int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space,
526526
memcpy(space->session_buf, chip->work_space.session_buf, PAGE_SIZE);
527527

528528
return 0;
529+
out:
530+
dev_err(&chip->dev, "%s: error %d\n", __func__, rc);
531+
return rc;
529532
}

0 commit comments

Comments
 (0)