From 7ce41f14c1fb18614fadbfbcc68dbe32c6a5c759 Mon Sep 17 00:00:00 2001 From: Liangwei Dong Date: Tue, 26 Nov 2019 16:49:08 +0800 Subject: [PATCH] qcacmn: Fix channel_map NULL Initialize channel_map to "us" at regulatory init. Use NUM_6GHZ_CHANNELS to get 6Ghz channel numbers instead of MAX_6GHZ_CHANNEL. Change-Id: Ifed996c1a528c8a3c0a29d3959f17dff6d298193 CRs-Fixed: 2949971 --- .../dispatcher/src/wlan_reg_services_api.c | 2 +- umac/scan/core/src/wlan_scan_cache_db.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index d21a43296f36..a4ddfe0f9af0 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -341,7 +341,7 @@ QDF_STATUS wlan_regulatory_init(void) reg_err("failed to register reg psoc obj create handler"); goto unreg_pdev_create; } - + channel_map = channel_map_global; reg_debug("regulatory handlers registered with obj mgr"); return status; diff --git a/umac/scan/core/src/wlan_scan_cache_db.c b/umac/scan/core/src/wlan_scan_cache_db.c index 8e36b2a53764..701a33dfd3fa 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.c +++ b/umac/scan/core/src/wlan_scan_cache_db.c @@ -182,9 +182,11 @@ static void scm_del_rnr_channel_db(struct scan_cache_entry *entry) return; } channel->bss_beacon_probe_count--; + cur_node = NULL; qdf_list_peek_front(&channel->rnr_list, &cur_node); /* Free the Node */ while (cur_node) { + next_node = NULL; qdf_list_peek_next(&channel->rnr_list, cur_node, &next_node); rnr_node = qdf_container_of(cur_node, @@ -1616,20 +1618,22 @@ QDF_STATUS scm_db_deinit(struct wlan_objmgr_psoc *psoc) #ifdef FEATURE_6G_SCAN_CHAN_SORT_ALGO QDF_STATUS scm_channel_list_db_init(struct wlan_objmgr_psoc *psoc) { - uint8_t i, j = 0; + uint32_t i, j; uint32_t min_freq, max_freq; min_freq = wlan_reg_min_6ghz_chan_freq(); max_freq = wlan_reg_max_6ghz_chan_freq(); scm_debug("min_freq %d max_freq %d", min_freq, max_freq); - for (i = min_freq; i <= max_freq; i += 20, j++) { - rnr_channel_db.channel[j].chan_freq = i; + i = min_freq; + for (j = 0; j < NUM_6GHZ_CHANNELS; j++) { + if (i >= min_freq && i <= max_freq) + rnr_channel_db.channel[j].chan_freq = i; qdf_list_create(&rnr_channel_db.channel[j].rnr_list, WLAN_MAX_RNR_COUNT); scm_debug("freq %d", i); + i += 20; } - return QDF_STATUS_SUCCESS; } @@ -1640,11 +1644,13 @@ QDF_STATUS scm_channel_list_db_deinit(struct wlan_objmgr_psoc *psoc) struct meta_rnr_channel *channel; struct scan_rnr_node *rnr_node; - for (i = 0; i <= MAX_6GHZ_CHANNEL; i++) { + for (i = 0; i < NUM_6GHZ_CHANNELS; i++) { channel = &rnr_channel_db.channel[i]; channel->chan_freq = 0; + cur_node = NULL; qdf_list_peek_front(&channel->rnr_list, &cur_node); while (cur_node) { + next_node = NULL; qdf_list_peek_next(&channel->rnr_list, cur_node, &next_node); rnr_node = qdf_container_of(cur_node,