diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index bc3c021d8cc0..af3fda007ddc 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -2154,6 +2154,7 @@ static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, struct net_device *ndev = wdev->netdev; struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(ndev); int status; + struct hdd_station_ctx *sta_ctx; hdd_enter_dev(ndev); @@ -2172,22 +2173,30 @@ static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, status = wlan_hdd_validate_vdev_id(adapter->vdev_id); if (status) return status; - - if (adapter->device_mode == QDF_STA_MODE || - adapter->device_mode == QDF_P2P_CLIENT_MODE) { - struct hdd_station_ctx *sta_ctx; - + switch (adapter->device_mode) { + case QDF_STA_MODE: + case QDF_P2P_CLIENT_MODE: sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); if (sta_ctx->hdd_reassoc_scenario) { hdd_debug("Roaming is in progress, rej this req"); return -EINVAL; } - if (sta_ctx->conn_info.conn_state != eConnectionState_Associated) { hdd_debug("Not associated"); return 0; } + break; + case QDF_SAP_MODE: + case QDF_P2P_GO_MODE: + if (!test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) { + hdd_err("SAP is not started yet"); + return 0; + } + break; + default: + hdd_debug_rl("Current interface is not supported for get tx_power"); + return 0; } if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) {