summaryrefslogtreecommitdiffstats
path: root/resources/depthcharge/patch/0005-vboot-Only-initialize-cparams-once.patch
blob: 8bc56a739724194811e44761e61a97e33d45e088 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 40668e8b5fb9a9e07a3b1ddf334bd4e12a38525f Mon Sep 17 00:00:00 2001
From: Paul Kocialkowski <contact@paulk.fr>
Date: Mon, 18 Apr 2016 11:14:19 +0200
Subject: [PATCH 5/8] vboot: Only initialize cparams once

Calling common_params_init multiple times in a row results in emptying cparams
each time, causing the GBB data to be lost as it is only read once (the first
time).

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 src/vboot/util/commonparams.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/vboot/util/commonparams.c b/src/vboot/util/commonparams.c
index 9f29473..3a71a8b 100644
--- a/src/vboot/util/commonparams.c
+++ b/src/vboot/util/commonparams.c
@@ -159,8 +159,10 @@ int is_cparams_initialized(void)
 int common_params_init(int clear_shared_data)
 {
 	// Set up the common param structure.
-	memset(&cparams, 0, sizeof(cparams));
-	cparams_initialized = 1;
+	if (!is_cparams_initialized()) {
+		memset(&cparams, 0, sizeof(cparams));
+		cparams_initialized = 1;
+	}
 
 	if (gbb_init())
 		return 1;
-- 
2.8.0