qcacmn: Dynamically allocate ch_list in wifi_pos_pdev_iterator()
Dynamically allocate ch_list in wifi_pos_pdev_iterator(), to avoid exceeding the stack frame limit with the introduction of new channels. Change-Id: I41aaa3ad0405a3023768e5278dacf7475524c4e0 CRs-Fixed: 2463009
This commit is contained in:

committed by
nshrivas

parent
5276ece978
commit
43168e82c6
@@ -713,21 +713,31 @@ static void wifi_pos_pdev_iterator(struct wlan_objmgr_psoc *psoc,
|
|||||||
void *obj, void *arg)
|
void *obj, void *arg)
|
||||||
{
|
{
|
||||||
QDF_STATUS status;
|
QDF_STATUS status;
|
||||||
uint8_t i, num_channels;
|
uint8_t i, num_channels, size;
|
||||||
struct wlan_objmgr_pdev *pdev = obj;
|
struct wlan_objmgr_pdev *pdev = obj;
|
||||||
struct wifi_pos_driver_caps *caps = arg;
|
struct wifi_pos_driver_caps *caps = arg;
|
||||||
struct channel_power ch_list[NUM_CHANNELS];
|
struct channel_power *ch_list;
|
||||||
|
|
||||||
|
size = QDF_MAX(OEM_CAP_MAX_NUM_CHANNELS, NUM_CHANNELS);
|
||||||
|
ch_list = qdf_mem_malloc(size * sizeof(*ch_list));
|
||||||
|
if (!ch_list)
|
||||||
|
return;
|
||||||
|
|
||||||
status = wlan_reg_get_channel_list_with_power(pdev, ch_list,
|
status = wlan_reg_get_channel_list_with_power(pdev, ch_list,
|
||||||
&num_channels);
|
&num_channels);
|
||||||
|
|
||||||
if (QDF_IS_STATUS_ERROR(status)) {
|
if (QDF_IS_STATUS_ERROR(status)) {
|
||||||
wifi_pos_err("Failed to get valid channel list");
|
wifi_pos_err("Failed to get valid channel list");
|
||||||
|
qdf_mem_free(ch_list);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (num_channels > OEM_CAP_MAX_NUM_CHANNELS)
|
||||||
|
num_channels = OEM_CAP_MAX_NUM_CHANNELS;
|
||||||
|
|
||||||
for (i = 0; i < num_channels; i++)
|
for (i = 0; i < num_channels; i++)
|
||||||
caps->channel_list[i] = ch_list[i].chan_num;
|
caps->channel_list[i] = ch_list[i].chan_num;
|
||||||
caps->num_channels = num_channels;
|
caps->num_channels = num_channels;
|
||||||
|
qdf_mem_free(ch_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wifi_pos_get_ch_info(struct wlan_objmgr_psoc *psoc,
|
static void wifi_pos_get_ch_info(struct wlan_objmgr_psoc *psoc,
|
||||||
|
Reference in New Issue
Block a user