From f2d37deda42d023574fbf4778aa7c578f91129d8 Mon Sep 17 00:00:00 2001 From: Andrew McRae Date: Tue, 18 Jan 2022 22:48:58 +1100 Subject: zephyr: Avoid calling task_get_current except in tasks. task_get_current is being called in in_deferred_context(), which may be invoked in initialisation code before the tasks have been started (so shimmed_tasks_dyn was not initialised). This fix avoids the use of any data that requires the EC tasks to have been initialised or started. BUG=b:213996924 TEST=zmake configure -b nivviks; flash and run BRANCH=none Signed-off-by: Andrew McRae Change-Id: I0bd1a13a8d5bbf8b3204695b7f9977fe99f63437 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3397883 Reviewed-by: Jack Rosenthal --- zephyr/shim/src/tasks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zephyr/shim/src/tasks.c b/zephyr/shim/src/tasks.c index 851a179f3e..42f4fd6b33 100644 --- a/zephyr/shim/src/tasks.c +++ b/zephyr/shim/src/tasks.c @@ -376,7 +376,7 @@ inline bool in_deferred_context(void) /* * Deferred calls run in the sysworkq. */ - return (task_get_current() == TASK_ID_SYSWORKQ); + return (k_current_get() == &k_sys_work_q.thread); } #if IS_ENABLED(CONFIG_KERNEL_SHELL) && IS_ENABLED(CONFIG_THREAD_MONITOR) -- cgit v1.2.1