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
This commit is contained in:
Arun Khandavalli 2017-11-14 19:43:00 +05:30 • committed by snandini
commit 5a62a82f0f

View file

@ -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);