summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2020-07-18 19:08:06 -0600
committerCommit Bot <commit-bot@chromium.org>2020-08-06 23:23:45 +0000
commit8d46141f4d45c65712a9ca7509b7b60128fa4d89 (patch)
tree3a8685f5351f2e7a41019ca5583f8e27e4e2fdee /common
parentda7d2c02f003d4ec739987624a13a3e7ac639613 (diff)
downloadchrome-ec-8d46141f4d45c65712a9ca7509b7b60128fa4d89.tar.gz
task: Fix mutex_lock() assert (reland)
mutex_lock() must not be used in interrupt context. Add an assert to catch this. Also assert task_start_called() since task ID is not valid before this. Also remove an old assert since comparing id with TASK_ID_INVALID doesn't make sense. This was first submitted as CL:2309057, then reverted by CL:2323704 because it broke jump to RW (b/162302011). Fix this by adding check for task_start_called() to chip/npcx/flash.c and common/i2c_master.c. BUG=b:160975910 BRANCH=none TEST=boot AP, jump to RW Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I070a265a95d2128643b536814e608509d81adbe3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2335738 Reviewed-by: Raul E Rangel <rrangel@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/i2c_master.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/i2c_master.c b/common/i2c_master.c
index f078e690f7..78a5e505b9 100644
--- a/common/i2c_master.c
+++ b/common/i2c_master.c
@@ -242,6 +242,10 @@ void i2c_prepare_sysjump(void)
{
int i;
+ /* Must not call mutex_lock() before task_start(). */
+ if (!task_start_called())
+ return;
+
/* Lock all i2c controllers */
for (i = 0; i < ARRAY_SIZE(port_mutex); ++i)
mutex_lock(port_mutex + i);