Parcourir la source

qcacmn: Add frequency check in reg_freq_to_band

In API reg_freq_to_band(), for frequency of value '0',
5 GHz band is returned.

Add check to return INVALID_BAND when frequency
passed as argument is '0'

Change-Id: Ie40ae73ae71769538bd04be4434dafa42b9d21d0
CRs-Fixed: 3620699
Vijay Raj il y a 1 an
Parent
commit
337f81f1d0

+ 3 - 0
umac/regulatory/core/src/reg_services_common.c

@@ -6197,6 +6197,9 @@ bool reg_is_same_band_freqs(qdf_freq_t freq1, qdf_freq_t freq2)
 
 enum reg_wifi_band reg_freq_to_band(qdf_freq_t freq)
 {
+	if (!freq)
+		return REG_BAND_UNKNOWN;
+
 	if (REG_IS_24GHZ_CH_FREQ(freq))
 		return REG_BAND_2G;
 	else if (REG_IS_5GHZ_FREQ(freq) || REG_IS_49GHZ_FREQ(freq))

+ 4 - 5
umac/regulatory/core/src/reg_services_common.h

@@ -58,15 +58,14 @@
 #ifdef CONFIG_49GHZ_CHAN
 #define REG_MIN_49GHZ_CH_FREQ channel_map[MIN_49GHZ_CHANNEL].center_freq
 #define REG_MAX_49GHZ_CH_FREQ channel_map[MAX_49GHZ_CHANNEL].center_freq
-#else
-#define REG_MIN_49GHZ_CH_FREQ 0
-#define REG_MAX_49GHZ_CH_FREQ 0
-#endif /* CONFIG_49GHZ_CHAN */
-
 #define REG_IS_49GHZ_FREQ(freq) \
 	(((freq) >= REG_MIN_49GHZ_CH_FREQ) &&   \
 	((freq) <= REG_MAX_49GHZ_CH_FREQ))
 
+#else
+#define REG_IS_49GHZ_FREQ(freq) false
+#endif /* CONFIG_49GHZ_CHAN */
+
 
 #define REG_IS_5GHZ_FREQ(freq) \
 	(((freq) >= channel_map[MIN_5GHZ_CHANNEL].center_freq) &&	\