From 13fa987a290a4ac9ce1d67bc40b1bcdb3ef0f583 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Tue, 13 Nov 2018 10:57:45 -0800 Subject: [PATCH] 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 --- core/hdd/src/wlan_hdd_main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 169bf2a5a108..15bfaaecc129 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -13440,6 +13440,14 @@ static int con_mode_handler(const char *kmessage, const struct kernel_param *kp) 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)) {