From 27dc40344d8b534e39b5787fdc4123947ed7f399 Mon Sep 17 00:00:00 2001 From: Hariharan Basuthkar Date: Wed, 29 Jul 2020 23:02:07 +0530 Subject: [PATCH] qcacmn: Check the state of 4.9G channels in reg_compute_chan_to_freq In the 5G radio, if the current regulatory domain does not support 4.9Ghz channels, and if 4.9Ghz IEEE channel number 1 to 11 are given as an input to reg_compute_chan_to_freq, instead of returning 0, it returns the corresponding center frequency of the 4.9 Ghz IEEE channel number. This is because the channel state and chan_flags of the 4.9Ghz channel are not checked, that is why it returns the valid channel frequency. To fix this issue, check the channel state and chan_flags of the 4.9Ghz channel before returning the non-zero channel frequency. Change-Id: Icedd74422b4194ac4f1affed7e9f131fb8426986 CRs-Fixed: 2738248 --- .../regulatory/core/src/reg_services_common.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/umac/regulatory/core/src/reg_services_common.c b/umac/regulatory/core/src/reg_services_common.c index c298375bbaef..890252a6f8eb 100644 --- a/umac/regulatory/core/src/reg_services_common.c +++ b/umac/regulatory/core/src/reg_services_common.c @@ -1787,16 +1787,17 @@ static uint16_t reg_compute_chan_to_freq(struct wlan_objmgr_pdev *pdev, chan_list = pdev_priv_obj->mas_chan_list; for (count = min_chan_range; count <= max_chan_range; count++) { - if (REG_IS_49GHZ_FREQ(chan_list[count].center_freq)) { - if (chan_list[count].chan_num == chan_num) + if ((chan_list[count].state != CHANNEL_STATE_DISABLE) && + !(chan_list[count].chan_flags & REGULATORY_CHAN_DISABLED)) { + if (REG_IS_49GHZ_FREQ(chan_list[count].center_freq)) { + if (chan_list[count].chan_num == chan_num) + break; + continue; + } else if ((chan_list[count].chan_num >= chan_num) && + (chan_list[count].chan_num != + INVALID_CHANNEL_NUM)) break; - continue; - } else if ((chan_list[count].chan_num >= chan_num) && - (chan_list[count].state != CHANNEL_STATE_DISABLE) && - !(chan_list[count].chan_flags & - REGULATORY_CHAN_DISABLED) && - (chan_list[count].chan_num != INVALID_CHANNEL_NUM)) - break; + } } if (count == max_chan_range + 1)