summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2021-04-29 00:05:23 -0600
committerCommit Bot <commit-bot@chromium.org>2021-05-02 05:57:30 +0000
commit2fa6cafe79c6ff83a53d4e4b14ce42e9fd0a7c91 (patch)
tree6be4e204453172929a15cdd87bca5f05a8af2b3e
parentb58e2cba26f06702838f2965003927b678e1859a (diff)
downloadchrome-ec-2fa6cafe79c6ff83a53d4e4b14ce42e9fd0a7c91.tar.gz
vboot: convert watchdog reload check to plain #ifdef
When not defining CONFIG_WATCHDOG or in Zephyr builds setting CONFIG_WATCHDOG=n the build would fail here because CONFIG_WATCHDOG_PERIOD_MS was not defined. This is avoided by using #ifdef instead of IS_ENABLED BRANCH=none BUG=none TEST=built lazor with and without zephyr Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I9f390bf32840fc98d38612cc1fcf00d779f902ee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2859466 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
-rw-r--r--common/vboot_hash.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/common/vboot_hash.c b/common/vboot_hash.c
index 9a6b9c196b..1bb9298ced 100644
--- a/common/vboot_hash.c
+++ b/common/vboot_hash.c
@@ -127,19 +127,19 @@ static void hash_next_chunk(size_t size)
static void vboot_hash_all_chunks(void)
{
- uint64_t prev_watchdog;
+#ifdef CONFIG_VBOOT_HASH_RELOAD_WATCHDOG
+ uint64_t prev_watchdog = get_time().val;
- if (IS_ENABLED(CONFIG_VBOOT_HASH_RELOAD_WATCHDOG)) {
- prev_watchdog = get_time().val;
- watchdog_reload();
- }
+ watchdog_reload();
+#endif
do {
size_t size = MIN(CHUNK_SIZE, data_size - curr_pos);
hash_next_chunk(size);
curr_pos += size;
- if (IS_ENABLED(CONFIG_VBOOT_HASH_RELOAD_WATCHDOG)) {
+#ifdef CONFIG_VBOOT_HASH_RELOAD_WATCHDOG
+ {
uint64_t cur_time = get_time().val;
if ((cur_time - prev_watchdog) >
@@ -148,6 +148,7 @@ static void vboot_hash_all_chunks(void)
prev_watchdog = cur_time;
}
}
+#endif
} while (curr_pos < data_size);
hash = SHA256_final(&ctx);