From 15a06789ee5d5b0cd0ecc6febb011e752ef1a525 Mon Sep 17 00:00:00 2001 From: Lincoln Tran Date: Fri, 17 Jul 2020 11:08:44 -0700 Subject: [PATCH] qcacld-3.0: Add condition for restarting SAP Currently, when SAP is being restarted on a phymode change, the logic will run unconditionally. Add a check to see if SAP is up first before attempting to restart it. Change-Id: I7c02b3c62d265c6e4989901bc108d53689425f0c CRs-fixed: 2734308 --- core/hdd/src/wlan_hdd_regulatory.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index 1ed822050314..5917fdc53163 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -1455,6 +1455,13 @@ static void hdd_restart_sap_with_new_phymode(struct hdd_context *hdd_ctx, hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter); sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter); + if (!test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) { + sap_config->sap_orig_hw_mode = sap_config->SapHw_mode; + sap_config->SapHw_mode = csr_phy_mode; + hdd_err("Can't restart AP because it is not started"); + return; + } + qdf_event_reset(&hostapd_state->qdf_stop_bss_event); status = wlansap_stop_bss(sap_ctx); if (!QDF_IS_STATUS_SUCCESS(status)) {