Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash in nrf70_bm_rt_init #48

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions nrf70_bm_lib/source/radio_test/nrf70_bm_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int nrf70_bm_rt_init(struct nrf70_bm_regulatory_info *reg_info)
goto deinit;
}

ret = nrf70_bm_rt_fmac_get_reg(&reg_info_curr);
ret = nrf70_bm_rt_get_reg(&reg_info_curr);
if (ret) {
NRF70_LOG_ERR("Failed to get regulatory info");
goto deinit;
Expand All @@ -48,17 +48,17 @@ int nrf70_bm_rt_init(struct nrf70_bm_regulatory_info *reg_info)
goto deinit;
}

memset(reg_info->chan_info,
memset(reg_info_curr.chan_info,
0,
sizeof(struct nrf70_bm_reg_chan_info) * NRF70_MAX_CHANNELS);

ret = nrf70_bm_rt_get_reg(reg_info);
ret = nrf70_bm_rt_get_reg(&reg_info_curr);
if (ret) {
printf("Failed to get regulatory info: %d\n", ret);
return -1;
}

printf("Regulatory country code set to: %s\n", reg_info->country_code);
printf("Regulatory country code set to: %s\n", reg_info_curr.country_code);
}
return 0;
deinit:
Expand Down
2 changes: 1 addition & 1 deletion nrf70_bm_lib/source/system/nrf70_bm_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int nrf70_bm_sys_init(uint8_t *mac_addr,
sizeof(struct nrf70_bm_reg_chan_info) *
NRF70_MAX_CHANNELS);

ret = nrf70_bm_sys_fmac_get_reg(&reg_info_curr);
ret = nrf70_bm_sys_get_reg(&reg_info_curr);
if (ret) {
NRF70_LOG_ERR("Failed to get regulatory info");
goto deinit;
Expand Down
11 changes: 0 additions & 11 deletions samples/radio_test_bm/src/nrf_wifi_radio_test_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ int main(void)
memcpy(reg_info.country_code, CONFIG_WIFI_RT_REG_DOMAIN, 2);
reg_info.force = true;

reg_info.chan_info = malloc(sizeof(struct nrf70_bm_reg_chan_info) * NRF70_MAX_CHANNELS);
if (!reg_info.chan_info) {
printf("Failed to allocate memory for regulatory info\n");
ret = -ENOMEM;
goto cleanup;
}

/* Initialize the Wi-Fi module */
CHECK_RET(nrf70_bm_rt_init(&reg_info));
printf("Initialized WiFi module, ready for radio test\n");
Expand All @@ -52,10 +45,6 @@ int main(void)
}

cleanup:
if (reg_info.chan_info) {
free(reg_info.chan_info);
}

if (ret) {
nrf70_bm_rt_deinit();
printf("Exiting WiFi radio test sample application with error: %d\n", ret);
Expand Down
12 changes: 0 additions & 12 deletions samples/scan_rt_bm/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,6 @@ int main(void)
int ret = -1;
int i;

reg_info.chan_info = malloc(sizeof(struct nrf70_bm_reg_chan_info) * NRF70_MAX_CHANNELS);
if (!reg_info.chan_info) {
printf("Failed to allocate memory for regulatory info\n");
ret = -ENOMEM;
goto cleanup;
}

for (i = 0; i < 2; i++) {
/*
* Radio test operation
Expand Down Expand Up @@ -318,11 +311,6 @@ int main(void)

ret = 0;
cleanup:
if (reg_info.chan_info) {
free(reg_info.chan_info);
reg_info.chan_info = NULL;
}

if (sys_init) {
nrf70_bm_sys_deinit();
sys_init = false;
Expand Down