Skip to content

Commit 65e42e7

Browse files
krish2718nordicjm
authored andcommitted
[nrf fromtree] drivers: nrf_wifi: Fix scan crash for 2nd VIF
Move the VIF initialization to top to do it for both VIFs, this fixes a crash when scanning on the 2nd VIF. Signed-off-by: Chaitanya Tata <[email protected]> (cherry picked from commit 386dcbe)
1 parent fc08ad1 commit 65e42e7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/wifi/nrf_wifi/src/fmac_main.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,14 @@ static int nrf_wifi_drv_main_zep(const struct device *dev)
752752

753753
/* Setup the linkage between the FMAC and the VIF contexts */
754754
vif_ctx_zep->rpu_ctx_zep = &rpu_drv_priv_zep.rpu_ctx_zep;
755+
#ifndef CONFIG_NRF70_RADIO_TEST
756+
k_work_init_delayable(&vif_ctx_zep->scan_timeout_work,
757+
nrf_wifi_scan_timeout_work);
758+
k_work_init(&vif_ctx_zep->disp_scan_res_work,
759+
nrf_wifi_disp_scan_res_work_handler);
760+
761+
vif_ctx_zep->bss_max_idle_period = USHRT_MAX;
762+
#endif /* !CONFIG_NRF70_RADIO_TEST */
755763

756764
if (fixed_vif_cnt++ > 0) {
757765
/* FMAC is already initialized for VIF-0 */
@@ -835,7 +843,6 @@ static int nrf_wifi_drv_main_zep(const struct device *dev)
835843

836844
rpu_drv_priv_zep.fmac_priv = nrf_wifi_rt_fmac_init();
837845
#endif /* CONFIG_NRF70_RADIO_TEST */
838-
839846
if (rpu_drv_priv_zep.fmac_priv == NULL) {
840847
LOG_ERR("%s: nrf_wifi_fmac_init failed",
841848
__func__);
@@ -864,17 +871,10 @@ static int nrf_wifi_drv_main_zep(const struct device *dev)
864871
LOG_ERR("%s: nrf_wifi_fmac_dev_add_zep failed", __func__);
865872
goto fmac_deinit;
866873
}
867-
#else
868-
k_work_init_delayable(&vif_ctx_zep->scan_timeout_work,
869-
nrf_wifi_scan_timeout_work);
870-
k_work_init(&vif_ctx_zep->disp_scan_res_work,
871-
nrf_wifi_disp_scan_res_work_handler);
872874
#endif /* CONFIG_NRF70_RADIO_TEST */
873875

874876
k_mutex_init(&rpu_drv_priv_zep.rpu_ctx_zep.rpu_lock);
875-
#ifndef CONFIG_NRF70_RADIO_TEST
876-
vif_ctx_zep->bss_max_idle_period = USHRT_MAX;
877-
#endif /* !CONFIG_NRF70_RADIO_TEST */
877+
878878
return 0;
879879
#ifdef CONFIG_NRF70_RADIO_TEST
880880
fmac_deinit:

0 commit comments

Comments
 (0)