summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@google.com>2019-02-01 12:48:44 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-03-06 06:51:00 -0800
commit26bff5c06189273298658f20cf8df4d83970cdaa (patch)
tree480032f5dea733695dca3ed058149a67deb579df
parent4aa18870f9a9609749a5a250f94e5ae26e943874 (diff)
downloadchrome-ec-26bff5c06189273298658f20cf8df4d83970cdaa.tar.gz
tpm_registers: check if_stop has been initialized before calling it
It's possible tpm_stop will be called before the interface has been registered. Don't call if_stop unless it has been initialized. BUG=none BRANCH=cr50 TEST=none Change-Id: I45b6d11553ce0eda5b097184a5be81f8b79726aa Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1480710 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--common/tpm_registers.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/common/tpm_registers.c b/common/tpm_registers.c
index 7447ef3191..823f9c7513 100644
--- a/common/tpm_registers.c
+++ b/common/tpm_registers.c
@@ -903,7 +903,9 @@ int tpm_sync_reset(int wipe_first)
void tpm_stop(void)
{
- if_stop();
+ /* Stop the TPM interface if it has been initialized. */
+ if (if_stop)
+ if_stop();
}
void tpm_task(void *u)