diff --git a/drivers/staging/qca-wifi-host-cmn/umac/regulatory/core/src/reg_services_common.c b/drivers/staging/qca-wifi-host-cmn/umac/regulatory/core/src/reg_services_common.c index 4678269ed294..7732e35b5ee4 100644 --- a/drivers/staging/qca-wifi-host-cmn/umac/regulatory/core/src/reg_services_common.c +++ b/drivers/staging/qca-wifi-host-cmn/umac/regulatory/core/src/reg_services_common.c @@ -3338,7 +3338,7 @@ reg_update_usable_chan_resp(struct wlan_objmgr_pdev *pdev, struct ch_params ch_params = {0}; int index = *count; - for (i = 0; i < len; i++) { + for (i = 0; i < len && index < NUM_CHANNELS; i++) { /* In case usable channels are required for multiple filter * mask, Some frequencies may present in res_msg . To avoid * frequency duplication, only mode mask is updated for @@ -3690,6 +3690,8 @@ reg_get_usable_channel_coex_filter(struct wlan_objmgr_pdev *pdev, chan_list[chan_enum].center_freq && freq_range.end_freq >= chan_list[chan_enum].center_freq) { + reg_debug("avoid freq %d", + chan_list[chan_enum].center_freq); reg_remove_freq(res_msg, chan_enum); } } @@ -3808,16 +3810,15 @@ wlan_reg_get_usable_channel(struct wlan_objmgr_pdev *pdev, } } - if (req_msg.filter_mask & 1 << FILTER_CELLULAR_COEX) - status = - reg_get_usable_channel_coex_filter(pdev, req_msg, res_msg, - chan_list, usable_channels); - if (req_msg.filter_mask & 1 << FILTER_WLAN_CONCURRENCY) status = reg_get_usable_channel_con_filter(pdev, req_msg, res_msg, usable_channels); + if (req_msg.filter_mask & 1 << FILTER_CELLULAR_COEX) + status = + reg_get_usable_channel_coex_filter(pdev, req_msg, res_msg, + chan_list, usable_channels); if (!(req_msg.filter_mask & 1 << FILTER_CELLULAR_COEX) && !(req_msg.filter_mask & 1 << FILTER_WLAN_CONCURRENCY)) status =