diff --git a/core/cds/src/cds_reg_service.c b/core/cds/src/cds_reg_service.c index 32cfc719d767..302c670c0aca 100644 --- a/core/cds/src/cds_reg_service.c +++ b/core/cds/src/cds_reg_service.c @@ -449,8 +449,8 @@ static void cds_set_5g_channel_params(uint16_t oper_ch, { enum channel_state chan_state = CHANNEL_STATE_ENABLE; enum channel_state chan_state2 = CHANNEL_STATE_ENABLE; - const struct bonded_chan *bonded_chan_ptr; - const struct bonded_chan *bonded_chan_ptr2; + const struct bonded_chan *bonded_chan_ptr = NULL; + const struct bonded_chan *bonded_chan_ptr2 = NULL; if (CH_WIDTH_MAX <= ch_params->ch_width) ch_params->ch_width = CH_WIDTH_80P80MHZ; @@ -481,16 +481,19 @@ static void cds_set_5g_channel_params(uint16_t oper_ch, bonded_chan_40mhz_array, QDF_ARRAY_SIZE(bonded_chan_40mhz_array), &bonded_chan_ptr2); - if (oper_ch == bonded_chan_ptr2->start_ch) - ch_params->sec_ch_offset = + if (bonded_chan_ptr && bonded_chan_ptr2) { + if (oper_ch == + bonded_chan_ptr2->start_ch) + ch_params->sec_ch_offset = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; - else - ch_params->sec_ch_offset = + else + ch_params->sec_ch_offset = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; - ch_params->center_freq_seg0 = - (bonded_chan_ptr->start_ch + - bonded_chan_ptr->end_ch)/2; + ch_params->center_freq_seg0 = + (bonded_chan_ptr->start_ch + + bonded_chan_ptr->end_ch)/2; + } } break; } @@ -501,8 +504,10 @@ static void cds_set_5g_channel_params(uint16_t oper_ch, chan_state = cds_search_5g_bonded_channel(oper_ch, CH_WIDTH_80MHZ, &bonded_chan_ptr); - ch_params->center_freq_seg0 = (bonded_chan_ptr->start_ch + - bonded_chan_ptr->end_ch)/2; + if (bonded_chan_ptr) + ch_params->center_freq_seg0 = + (bonded_chan_ptr->start_ch + + bonded_chan_ptr->end_ch)/2; } QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO, "ch %d ch_wd %d freq0 %d freq1 %d", oper_ch,