qcacmn: Fix channel conversion APIs in the regulatory component

Update the APIs mentioned below, to handle invalid channel number and
freq value of less than or equal to 0:

1) wlan_reg_chan_band_to_freq
2) wlan_reg_freq_to_chan
3) wlan_reg_chan_to_freq
4) wlan_reg_legacy_chan_to_freq

Change-Id: I122658c974c550ff16bcfe1b664799a609c7ffcf
CRs-Fixed: 2550286
Этот коммит содержится в:
Hariharan Basuthkar
2019-10-21 20:58:26 +05:30
коммит произвёл nshrivas
родитель 5ad018742a
Коммит 6f59c89126

Просмотреть файл

@@ -1632,6 +1632,11 @@ uint32_t reg_freq_to_chan(struct wlan_objmgr_pdev *pdev,
struct regulatory_channel *chan_list;
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
if (freq == 0) {
reg_err_rl("Invalid frequency %d", freq);
return 0;
}
pdev_priv_obj = reg_get_pdev_obj(pdev);
if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
@@ -1732,6 +1737,11 @@ uint16_t reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev,
uint16_t min_chan_range = MIN_24GHZ_CHANNEL;
uint16_t max_chan_range = MAX_5GHZ_CHANNEL;
if (chan_num == 0) {
reg_err_rl("Invalid channel %d", chan_num);
return 0;
}
return reg_compute_chan_to_freq(pdev, chan_num,
min_chan_range,
max_chan_range);
@@ -1745,6 +1755,11 @@ uint32_t reg_chan_to_freq(struct wlan_objmgr_pdev *pdev,
struct regulatory_channel *chan_list;
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
if (chan_num == 0) {
reg_err_rl("Invalid channel %d", chan_num);
return 0;
}
pdev_priv_obj = reg_get_pdev_obj(pdev);
if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
@@ -2448,6 +2463,11 @@ uint16_t reg_chan_band_to_freq(struct wlan_objmgr_pdev *pdev,
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
uint16_t freq;
if (chan_num == 0) {
reg_err_rl("Invalid channel %d", chan_num);
return 0;
}
pdev_priv_obj = reg_get_pdev_obj(pdev);
if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
reg_err("reg pdev priv obj is NULL");