From 5a62a82f0fd86c6b2f383abf3d6b40783eb9c01e Mon Sep 17 00:00:00 2001 From: Arun Khandavalli Date: Tue, 14 Nov 2017 19:43:00 +0530 Subject: [PATCH] qcacld-3.0: set modules_inprogress only when modules state is < 3 check if the modules are enabled before setting the start_modules_in_progress flag. In some scenario one thread could be checking if the modules is enabled by setting start_modules_inprogress flag, in the other thread context some process reading this flag can take a wrong decision resulting in not expected output even though modules are properly enabled. Hence, set the start_modules_inprogress only if modules are not enabled. CRs-Fixed: 2142855 Change-Id: I24345375bb1ad21d055ff934a72b3df4d815ea16 --- core/hdd/src/wlan_hdd_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index ecae11b16cce..2508cd7829ef 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -2320,6 +2320,13 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, qdf_cancel_delayed_work(&hdd_ctx->iface_idle_work); mutex_lock(&hdd_ctx->iface_change_lock); + if (hdd_ctx->driver_status == DRIVER_MODULES_ENABLED) { + mutex_unlock(&hdd_ctx->iface_change_lock); + hdd_info("Driver modules already Enabled"); + EXIT(); + return 0; + } + hdd_ctx->start_modules_in_progress = true; switch (hdd_ctx->driver_status) { @@ -2458,9 +2465,6 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, hdd_info("Driver Modules Successfully Enabled"); hdd_ctx->driver_status = DRIVER_MODULES_ENABLED; break; - case DRIVER_MODULES_ENABLED: - hdd_info("Driver modules already Enabled"); - break; default: hdd_err("WLAN start invoked in wrong state! :%d\n", hdd_ctx->driver_status);