qcacld-3.0: Ignore uninitialized driver mode change
The driver mode can be dynamically controlled via the module parameter
"con_mode," which triggers the callback con_mode_handler(). However, if
the wlan module is loaded with a non-default con_mode, this callback
handler is invoked before module init (e.g. 'insmod wlan.ko
con_mode=5'). If con_mode_handler is invoked before module init, simply
return success, as no processing is needed.
Change-Id: Iaa426188d13507cc6c7f09a03effd881854bbf3d
CRs-Fixed: 2349370
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 169bf2a..15bfaae 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -13440,6 +13440,14 @@
hdd_enter();
+ /* This handler will be invoked before module init when the wlan driver
+ * is loaded using 'insmod wlan.ko con_mode=5' for example. Return
+ * success in this case, as module init will bring up the correct
+ * con_mode when it runs.
+ */
+ if (hdd_driver->state == driver_state_uninit)
+ return 0;
+
status = dsc_driver_trans_start_wait(hdd_driver->dsc_driver,
"mode change");
if (QDF_IS_STATUS_ERROR(status)) {