diff --git a/core/hdd/src/wlan_hdd_apf.c b/core/hdd/src/wlan_hdd_apf.c index 37c2c377d1..cddb25fbdd 100644 --- a/core/hdd/src/wlan_hdd_apf.c +++ b/core/hdd/src/wlan_hdd_apf.c @@ -495,6 +495,13 @@ static int hdd_apf_read_memory(struct hdd_adapter *adapter, struct nlattr **tb) int ret = 0; struct sk_buff *skb = NULL; uint8_t *bufptr; + mac_handle_t mac_handle; + + mac_handle = hdd_adapter_get_mac_handle(adapter); + if (!mac_handle) { + hdd_debug("mac ctx NULL"); + return -EINVAL; + } if (context->apf_enabled) { hdd_err("Cannot get/set while interpreter is enabled"); @@ -536,8 +543,7 @@ static int hdd_apf_read_memory(struct hdd_adapter *adapter, struct nlattr **tb) context->buf_len = read_mem_params.length; context->magic = APF_CONTEXT_MAGIC; - status = sme_apf_read_work_memory(hdd_adapter_get_mac_handle(adapter), - &read_mem_params, + status = sme_apf_read_work_memory(mac_handle, &read_mem_params, hdd_apf_read_memory_callback); if (QDF_IS_STATUS_ERROR(status)) { hdd_err("Unable to post sme APF read memory message (status-%d)", diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 498a1f0085..0b33926a07 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -2137,12 +2137,16 @@ static void hdd_roam_channel_switch_handler(struct hdd_adapter *adapter, struct hdd_chan_change_params chan_change; QDF_STATUS status; struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); - mac_handle_t mac_handle = hdd_adapter_get_mac_handle(adapter); + mac_handle_t mac_handle; struct hdd_station_ctx *sta_ctx; uint8_t connected_vdev; bool notify = true, is_sap_go_moved_before_sta = false; struct wlan_objmgr_vdev *vdev; + mac_handle = hdd_adapter_get_mac_handle(adapter); + if (!mac_handle) + return; + /* Enable Roaming on STA interface which was disabled before CSA */ if (adapter->device_mode == QDF_STA_MODE) sme_start_roaming(mac_handle, adapter->deflink->vdev_id, diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 39574a081a..8cbf3fcc9f 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -19767,6 +19767,11 @@ int hdd_get_rssi_snr_by_bssid(struct hdd_adapter *adapter, const uint8_t *bssid, mac_handle_t mac_handle; mac_handle = hdd_adapter_get_mac_handle(adapter); + if (!mac_handle) { + hdd_err("mac context NULL"); + return -EINVAL; + } + status = sme_get_rssi_snr_by_bssid(mac_handle, bssid, rssi, snr); if (QDF_STATUS_SUCCESS != status) { hdd_debug("sme_get_rssi_snr_by_bssid failed"); diff --git a/core/hdd/src/wlan_hdd_nan_datapath.c b/core/hdd/src/wlan_hdd_nan_datapath.c index f9bb3ad63a..662f432e68 100644 --- a/core/hdd/src/wlan_hdd_nan_datapath.c +++ b/core/hdd/src/wlan_hdd_nan_datapath.c @@ -306,6 +306,11 @@ static int hdd_ndi_start_bss(struct hdd_adapter *adapter) hdd_enter(); hdd_ctx = WLAN_HDD_GET_CTX(adapter); + if (!mac) { + hdd_debug("mac ctx NULL"); + return -EINVAL; + } + status = hdd_ndi_select_valid_freq(hdd_ctx, &valid_freq); if (!QDF_IS_STATUS_SUCCESS(status)) { hdd_err("Unable to retrieve channel list for NAN");