diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 48cddd1ea0..bc3c021d8c 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -2020,7 +2020,7 @@ static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, { struct hdd_context *hdd_ctx = (struct hdd_context *) wiphy_priv(wiphy); mac_handle_t mac_handle; - struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(wdev->netdev); + struct hdd_adapter *adapter; struct qdf_mac_addr bssid = QDF_MAC_ADDR_BCAST_INIT; struct qdf_mac_addr selfmac; QDF_STATUS status; @@ -2029,6 +2029,13 @@ static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, hdd_enter(); + if (!wdev) { + hdd_err("wdev is null, set tx power failed"); + return -EIO; + } + + adapter = WLAN_HDD_GET_PRIV_PTR(wdev->netdev); + if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { hdd_err("Command not allowed in FTM mode"); return -EINVAL;