diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2017-02-04 19:47:39 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-02-06 12:47:03 -0800 |
commit | 80323260aef21e3d25dffb1b70f3a83e18e802a1 (patch) | |
tree | 686514e71529aab0c4aaefc3cd6aa8407d0afa49 | |
parent | e3fc75fbc5c28379be5b7da0516ecfa92a1968f3 (diff) | |
download | chrome-ec-80323260aef21e3d25dffb1b70f3a83e18e802a1.tar.gz |
common: do not release lock after nvmem read when commits are suspended
The nvmem_release_cache() function checks if there is a pending write
and refuses to release the lock if so. It should also be checking if
submits have need suspended, as the task suspending commits is holding
the lock and is supposed to release it explicitly when done.
BRANCH=none
BUG=chrome-os-partner:62531
TEST=verified that the message reporting attempts to commit when cache
is unlocked is not showing up at startup any more,
Change-Id: I5a63e7421cdd4a6b11dddff3103e1d63e0be0e65
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/437758
Reviewed-by: Scott Collyer <scollyer@chromium.org>
-rw-r--r-- | common/nvmem.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/nvmem.c b/common/nvmem.c index 561fa5e537..2f7d37923c 100644 --- a/common/nvmem.c +++ b/common/nvmem.c @@ -77,7 +77,7 @@ struct nvmem_mutex_ { struct mutex mtx; }; -static struct nvmem_mutex_ nvmem_mutex; +static struct nvmem_mutex_ nvmem_mutex = { .task = TASK_ID_COUNT }; static uint8_t nvmem_cache[NVMEM_PARTITION_SIZE] __aligned(4); static uint8_t commits_enabled; @@ -229,7 +229,7 @@ static void nvmem_lock_cache(void) static void nvmem_release_cache(void) { - if (nvmem_mutex.write_in_progress) + if (nvmem_mutex.write_in_progress || !commits_enabled) return; /* It will have to be saved first. */ /* Reset task number to max value */ |