summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2016-09-27 22:26:18 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-09-28 16:00:00 -0700
commitd2ee66555a4ef43820aa8c5dd920f2924e849526 (patch)
tree258d11ee879f9fa905efabf802ef5ec2193b3802
parent91d23fa94d6a8504da654053ba1f923a7e03c949 (diff)
downloadchrome-ec-d2ee66555a4ef43820aa8c5dd920f2924e849526.tar.gz
nvmem: fix partition number assignment in nvmem.c
Partition number must be set before partition lock is attempted. BRANCH=none BUG=none TEST=the cert installation image does not crash on gru any more Change-Id: Ibc81e2e741fafb75f4e4bb5dbfc0dae32d354646 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/390416 Reviewed-by: Scott Collyer <scollyer@chromium.org>
-rw-r--r--common/nvmem.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/nvmem.c b/common/nvmem.c
index 3696d00279..ffdb78bb2d 100644
--- a/common/nvmem.c
+++ b/common/nvmem.c
@@ -314,13 +314,14 @@ int nvmem_setup(uint8_t starting_version)
* both corrupted
*/
for (part = 0; part < NVMEM_NUM_PARTITIONS; part++) {
+ /* Set active partition variable */
+ nvmem_act_partition = part;
+
/* Get the cache buffer */
if (nvmem_lock_cache() != EC_SUCCESS) {
CPRINTF("NvMem: Cache ram not available!\n");
return EC_ERROR_TIMEOUT;
}
- /* Set active partition variable */
- nvmem_act_partition = part;
/* Fill entire partition to 0xFFs */
memset(cache.base_ptr, 0xff, NVMEM_PARTITION_SIZE);
/* Get pointer to start of partition */