Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Unified Diff: firmware/stub/tpm_lite_stub.c

Issue 5796005: vboot TPM stub functions return error codes (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Respond to code reviews Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « firmware/lib/tpm_lite/tlcl.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: firmware/stub/tpm_lite_stub.c
diff --git a/firmware/stub/tpm_lite_stub.c b/firmware/stub/tpm_lite_stub.c
index 2695fae35d7136bec9a0d5ee080577588b52e6eb..2351ee47e7a645566d483eeeacee644841609ade 100644
--- a/firmware/stub/tpm_lite_stub.c
+++ b/firmware/stub/tpm_lite_stub.c
@@ -99,22 +99,25 @@ POSSIBLY_UNUSED static INLINE int TpmResponseSize(const uint8_t* buffer) {
}
-void TlclStubInit(void) {
- TlclOpenDevice();
+uint32_t TlclStubInit(void) {
+ return TlclOpenDevice();
}
-void TlclCloseDevice(void) {
- close(tpm_fd);
- tpm_fd = -1;
+uint32_t TlclCloseDevice(void) {
+ if (tpm_fd != -1) {
+ close(tpm_fd);
+ tpm_fd = -1;
+ }
+ return 0;
}
-void TlclOpenDevice(void) {
+uint32_t TlclOpenDevice(void) {
char* device_path;
if (tpm_fd >= 0)
- return; /* Already open */
+ return 0; /* Already open */
device_path = getenv("TPM_DEVICE_PATH");
if (device_path == NULL) {
@@ -123,8 +126,12 @@ void TlclOpenDevice(void) {
tpm_fd = open(device_path, O_RDWR);
if (tpm_fd < 0) {
- error("cannot open TPM device %s: %s\n", device_path, strerror(errno));
+ VBDEBUG(("TPM: Cannot open TPM device %s: %s\n", device_path,
+ strerror(errno)));
+ return TPM_E_IOERROR;
}
+
+ return 0;
}
« no previous file with comments | « firmware/lib/tpm_lite/tlcl.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698