From 4050a850acc6bef38dc1f473f4ddd2e02e75efae Mon Sep 17 00:00:00 2001 From: Hariharan Basuthkar Date: Tue, 26 Nov 2019 10:21:57 +0530 Subject: [PATCH] qcacmn: Rectify the API wlan_reg_is_6ghz_psc_chan_freq While checking if a channel frequency is 6Ghz PSC frequency within wlan_reg_is_6ghz_psc_chan_freq, check the remainder of the expression, instead of quotient. Change-Id: Ia40d7cd8485f9f8eb90222f9a3454d46e681681b CRs-Fixed: 2572914 --- umac/regulatory/core/src/reg_services_common.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/umac/regulatory/core/src/reg_services_common.c b/umac/regulatory/core/src/reg_services_common.c index 3a65f47b9964..ea275dfdeeae 100644 --- a/umac/regulatory/core/src/reg_services_common.c +++ b/umac/regulatory/core/src/reg_services_common.c @@ -2365,19 +2365,17 @@ uint16_t reg_max_6ghz_chan_freq(void) bool reg_is_6ghz_psc_chan_freq(uint16_t freq) { - uint8_t count; - if (!REG_IS_6GHZ_FREQ(freq)) { reg_debug(" Channel frequency is not a 6GHz frequency"); return false; } - for (count = 1; count <= NUM_PSC_FREQ; count++) { - if (count == - (((freq - SIXG_STARTING_FREQ) + (FREQ_LEFT_SHIFT)) / - (FREQ_TO_CHAN_SCALE * NUM_80MHZ_BAND_IN_6G))) - return true; + + if (!(((freq - SIXG_STARTING_FREQ) + (FREQ_LEFT_SHIFT)) % + (FREQ_TO_CHAN_SCALE * NUM_80MHZ_BAND_IN_6G))) { + return true; } - reg_debug(" Channel frequency is not a 6GHz PSC frequency"); + + reg_debug_rl("Channel freq %d MHz is not a 6GHz PSC frequency", freq); return false; }