From 45a38684b07295822dc8eba39e293408f203eec8 Mon Sep 17 00:00:00 2001 From: Arun Kumar Khandavalli Date: Tue, 11 Aug 2020 22:40:45 +0530 Subject: [PATCH] qcacmn: Check if the scheduler thread is already flushed During the module initialization the scheduler thread and the init thread run in parallel if there is a failure in the error path, the scheduler thread is not aware and still sending the messages to firmware resulting in system instability. So, Disable the scheduler as soon as there is an error in the init path and the same scheduler thread in the normal existing error path. If the scheduler_disable is called multiple times the infinite wait for result will get the init thread struck. Change-Id: I39782bc88d49dac2e2138c235c4666ea4f4f2faf CRs-Fixed: 2754023 --- scheduler/src/scheduler_api.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scheduler/src/scheduler_api.c b/scheduler/src/scheduler_api.c index 328ece9414..a01f8ffacd 100644 --- a/scheduler/src/scheduler_api.c +++ b/scheduler/src/scheduler_api.c @@ -33,6 +33,11 @@ QDF_STATUS scheduler_disable(void) if (!sched_ctx) return QDF_STATUS_E_INVAL; + if (!sched_ctx->sch_thread) { + sched_debug("Scheduler already disabled"); + return QDF_STATUS_SUCCESS; + } + /* send shutdown signal to scheduler thread */ qdf_atomic_set_bit(MC_SHUTDOWN_EVENT_MASK, &sched_ctx->sch_event_flag); qdf_atomic_set_bit(MC_POST_EVENT_MASK, &sched_ctx->sch_event_flag);