Commit 8404da75 authored by francescomani's avatar francescomani

nullPointerRedundantCheck

parent ddf3b161
......@@ -395,11 +395,9 @@ void write_parsedcfg(configmodule_interface_t *cfgptr)
cfgptr->status->emptyla,
cfgptr->status->num_write);
}
if (cfgptr != NULL) {
if (cfgptr->write_parsedcfg != NULL) {
printf("[CONFIG] calling config module write_parsedcfg function...\n");
cfgptr->write_parsedcfg(cfgptr);
}
if (cfgptr->write_parsedcfg != NULL) {
printf("[CONFIG] calling config module write_parsedcfg function...\n");
cfgptr->write_parsedcfg(cfgptr);
}
}
......@@ -407,8 +405,8 @@ void write_parsedcfg(configmodule_interface_t *cfgptr)
/* config module could be initialized again after this call */
void end_configmodule(configmodule_interface_t *cfgptr)
{
write_parsedcfg(cfgptr);
if (cfgptr != NULL) {
write_parsedcfg(cfgptr);
if (cfgptr->end != NULL) {
printf ("[CONFIG] calling config module end function...\n");
cfgptr->end(cfgptr);
......
......@@ -592,7 +592,7 @@ static void initialize_agent(ngran_node_t node_type, e2_agent_args_t oai_args)
nb_id = rrc->node_id;
} else if (node_type == ngran_gNB_DU) {
const gNB_MAC_INST* mac = RC.nrmac[0];
AssertFatal(mac != NULL, "MAC not initialized\n");
AssertFatal(mac, "MAC not initialized\n");
cu_du_id = mac->f1_config.gnb_id;
nb_id = mac->f1_config.setup_req->gNB_DU_id;
} else if (node_type == ngran_gNB_CU || node_type == ngran_gNB_CUCP) {
......
......@@ -423,7 +423,7 @@ int aerial_phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind)
{
if (NFAPI_MODE == NFAPI_MODE_AERIAL) {
nfapi_nr_uci_indication_t *uci_ind = CALLOC(1, sizeof(*uci_ind));
AssertFatal(uci_ind != NULL, "Memory not allocated for uci_ind in phy_nr_uci_indication.");
AssertFatal(uci_ind, "Memory not allocated for uci_ind in phy_nr_uci_indication.");
*uci_ind = *ind;
uci_ind->uci_list = CALLOC(NFAPI_NR_UCI_IND_MAX_PDU, sizeof(nfapi_nr_uci_t));
......
......@@ -759,7 +759,7 @@ int phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind)
if(NFAPI_MODE == NFAPI_MODE_VNF)
{
nfapi_nr_uci_indication_t *uci_ind = CALLOC(1, sizeof(*uci_ind));
AssertFatal(uci_ind != NULL, "Memory not allocated for uci_ind in phy_nr_uci_indication.");
AssertFatal(uci_ind, "Memory not allocated for uci_ind in phy_nr_uci_indication.");
*uci_ind = *ind;
uci_ind->uci_list = CALLOC(NFAPI_NR_UCI_IND_MAX_PDU, sizeof(nfapi_nr_uci_t));
......
......@@ -110,10 +110,9 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui
// printf("currentPtr %p (polarParams %p)\n",currentPtr,polarParams);
//Else, initialize and add node to the end of the linked list.
t_nrPolar_params *newPolarInitNode = calloc(sizeof(t_nrPolar_params),1);
newPolarInitNode->busy=true;
AssertFatal(newPolarInitNode, "[nr_polar_init] New t_nrPolar_params * could not be created");
newPolarInitNode->busy = true;
pthread_mutex_unlock(&PolarListMutex);
AssertFatal(newPolarInitNode != NULL, "[nr_polar_init] New t_nrPolar_params * could not be created");
// LOG_D(PHY,"Setting new polarParams index %d, messageType %d, messageLength %d, aggregation_prime %d\n",(messageType * messageLength * aggregation_prime),messageType,messageLength,aggregation_prime);
newPolarInitNode->idx = PolarKey;
......
......@@ -41,8 +41,8 @@ double get_pa_dB(uint8_t pa)
}
double computeRhoA_eNB(uint8_t pa,
LTE_eNB_DLSCH_t *dlsch_eNB, int dl_power_off, uint8_t n_antenna_port){
double computeRhoA_eNB(uint8_t pa, LTE_eNB_DLSCH_t *dlsch_eNB, int dl_power_off, uint8_t n_antenna_port)
{
double rho_a_dB;
double sqrt_rho_a_lin;
......@@ -59,10 +59,10 @@ double computeRhoA_eNB(uint8_t pa,
if (dlsch_eNB) {
dlsch_eNB->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13));
dlsch_eNB->pa = pa;
}
#if DEBUG_PC
printf("eNB: p_a=%d, value=%f, sqrt_rho_a=%d\n",p_a,pa_values[ pdsch_config_dedicated->p_a],dlsch_eNB->sqrt_rho_a);
printf("eNB: p_a=%d, value=%f, sqrt_rho_a=%d\n", p_a, pa_values[pdsch_config_dedicated->p_a], dlsch_eNB->sqrt_rho_a);
#endif
}
return(rho_a_dB);
}
......@@ -89,12 +89,12 @@ double computeRhoB_eNB(uint8_t pa,
sqrt_rho_b_lin= pow(10,(0.05*rho_b_dB));
if (dlsch_eNB) {
dlsch_eNB->sqrt_rho_b= (short) (sqrt_rho_b_lin*pow(2,13));
dlsch_eNB->sqrt_rho_b = (short) (sqrt_rho_b_lin * pow(2, 13));
dlsch_eNB->pb = pb;
}
#ifdef DEBUG_PC
printf("eNB: n_ant=%d, p_b=%d -> rho_b/rho_a=%f -> sqrt_rho_b=%d\n",n_antenna_port,pb,ratioPB[1][pb],dlsch_eNB->sqrt_rho_b);
printf("eNB: n_ant=%d, p_b=%d -> rho_b/rho_a=%f -> sqrt_rho_b=%d\n", n_antenna_port, pb, ratioPB[1][pb], dlsch_eNB->sqrt_rho_b);
#endif
}
return(rho_b_dB);
}
......
......@@ -42,7 +42,7 @@ static NR_gNB_ULSCH_t *find_nr_ulsch(PHY_VARS_gNB *gNB, uint16_t rnti, int pid)
for (int i = 0; i < gNB->max_nb_pusch; i++) {
ulsch = &gNB->ulsch[i];
AssertFatal(ulsch != NULL, "gNB->ulsch[%d] is null\n", i);
AssertFatal(ulsch, "gNB->ulsch[%d] is null\n", i);
if (!ulsch->active) {
if (first_free_index == -1)
first_free_index = i;
......
......@@ -688,9 +688,8 @@ int main(int argc, char **argv) {
else {
while(fgets(buf, 63, proc_fd))
printf("%s", buf);
fclose(proc_fd);
}
fclose(proc_fd);
cpu_freq_GHz = ((double)atof(buf))/1e6;
#else
cpu_freq_GHz = get_cpu_freq_GHz();
......
......@@ -107,6 +107,7 @@ double dac_fixed_gain(double *s_re[2],
*amp1p=sqrt(*amp1p);
}
AssertFatal(amp1p != NULL && *amp1p != 0.0, "Precondition to avoid UB\n");
#ifdef DEBUG_DAC
LOG_I(OCM,"DAC: amp %f, amp1 %f dB (%d,%d), tx_power target %f (actual %f %f),length %d,pos %d\n",
......@@ -122,7 +123,6 @@ double dac_fixed_gain(double *s_re[2],
#endif
AssertFatal(amp1p != NULL && *amp1p != 0.0, "Precondition to avoid UB\n");
for (i=0; i<length; i++) {
for (aa=0; aa<nb_tx_antennas; aa++) {
s_re[aa][i] = amp*((double)(((short *)input[aa]))[((i+input_offset)<<1)])/(*amp1p);
......
......@@ -344,7 +344,7 @@ void do_UL_sig(sim_t *sim, uint16_t subframe, uint8_t abstraction_flag, LTE_DL_F
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
txdata = PHY_vars_UE_g[UE_id][CC_id]->common_vars.txdata;
AssertFatal(txdata != NULL,"txdata is null\n");
AssertFatal(txdata,"txdata is null\n");
sf_offset = subframe*frame_parms->samples_per_tti;
if (subframe>0) sf_offset_tdd = sf_offset - PHY_vars_UE_g[UE_id][CC_id]->N_TA_offset;
......
......@@ -2033,8 +2033,8 @@ int get_channel_params(char *buf, int debug, void *vdata, telnet_printfunc_t prn
}
tdata->numlines++;
}
return tdata->numlines;
}
return tdata->numlines;
} /* show */ else if (strstr(buf, "set") == buf) {
char cmdbuf[TELNET_MAX_MSGLENGTH];
int sst = sscanf(tdata->tblname, "%*[^=]=%i", &chanidx);
......@@ -2229,11 +2229,12 @@ int get_modchannel_index(char *buf, int debug, void *vdata, telnet_printfunc_t p
if (debug)
LOG_I(UTIL, "%s received %s\n", __FUNCTION__, buf);
webdatadef_t *tdata = (webdatadef_t *)vdata;
tdata->numlines = 0;
if (strncmp(buf, "set", 3) == 0) {
return get_channel_params(buf, debug, vdata, prnt);
}
int numlines = 0;
if (tdata != NULL) {
tdata->numlines = 0;
for (int i = 0; i < max_chan; i++) {
if (defined_channels[i] != NULL) {
tdata->numlines++;
......@@ -2245,8 +2246,9 @@ int get_modchannel_index(char *buf, int debug, void *vdata, telnet_printfunc_t p
else {
snprintf(tdata->tblname, sizeof(tdata->tblname) - 1, "No running model in the system");
}
numlines = tdata->numlines;
}
return tdata->numlines;
return numlines;
} /* get_currentchannel_type */
/*------------------------------------------------------------------------------------------------------------------*/
......
......@@ -2030,21 +2030,21 @@ void *E1AP_CUUP_task(void *arg)
case E1AP_BEARER_CONTEXT_SETUP_RESP: {
const e1ap_bearer_setup_resp_t *resp = &E1AP_BEARER_CONTEXT_SETUP_RESP(msg);
const e1ap_upcp_inst_t *inst = getCxtE1(myInstance);
AssertFatal(inst != NULL, "no E1 instance found for instance %ld\n", myInstance);
AssertFatal(inst, "no E1 instance found for instance %ld\n", myInstance);
e1apCUUP_send_BEARER_CONTEXT_SETUP_RESPONSE(inst->cuup.assoc_id, resp);
} break;
case E1AP_BEARER_CONTEXT_MODIFICATION_RESP: {
const e1ap_bearer_modif_resp_t *resp = &E1AP_BEARER_CONTEXT_MODIFICATION_RESP(msg);
const e1ap_upcp_inst_t *inst = getCxtE1(myInstance);
AssertFatal(inst != NULL, "no E1 instance found for instance %ld\n", myInstance);
AssertFatal(inst, "no E1 instance found for instance %ld\n", myInstance);
e1apCUUP_send_BEARER_CONTEXT_MODIFICATION_RESPONSE(inst->cuup.assoc_id, resp);
} break;
case E1AP_BEARER_CONTEXT_RELEASE_CPLT: {
const e1ap_bearer_release_cplt_t *cplt = &E1AP_BEARER_CONTEXT_RELEASE_CPLT(msg);
const e1ap_upcp_inst_t *inst = getCxtE1(myInstance);
AssertFatal(inst != NULL, "no E1 instance found for instance %ld\n", myInstance);
AssertFatal(inst, "no E1 instance found for instance %ld\n", myInstance);
e1apCUUP_send_BEARER_CONTEXT_RELEASE_COMPLETE(inst->cuup.assoc_id, cplt);
} break;
......
......@@ -179,10 +179,10 @@ static void capture_sst_sd(test_cond_value_t* test_cond_value, uint8_t *sst, uin
static bool nssai_matches(nssai_t a_nssai, uint8_t b_sst, const uint32_t *b_sd)
{
AssertFatal(b_sd == NULL || *b_sd <= 0xffffff, "illegal SD %d\n", *b_sd);
if (b_sd == NULL) {
return a_nssai.sst == b_sst && a_nssai.sd == 0xffffff;
} else {
AssertFatal(*b_sd <= 0xffffff, "illegal SD %d\n", *b_sd);
return a_nssai.sst == b_sst && a_nssai.sd == *b_sd;
}
}
......
......@@ -53,7 +53,7 @@ bool cu_add_f1_ue_data(uint32_t ue_id, const f1_ue_data_t *data)
return false;
}
f1_ue_data_t *idata = malloc(sizeof(*idata));
AssertFatal(idata != NULL, "cannot allocate memory\n");
AssertFatal(idata, "cannot allocate memory\n");
*idata = *data;
hashtable_rc_t ret = hashtable_insert(cu2du_ue_mapping, key, idata);
pthread_mutex_unlock(&cu2du_mutex);
......@@ -116,7 +116,7 @@ bool du_add_f1_ue_data(uint32_t ue_id, const f1_ue_data_t *data)
return false;
}
f1_ue_data_t *idata = malloc(sizeof(*idata));
AssertFatal(idata != NULL, "cannot allocate memory\n");
AssertFatal(idata, "cannot allocate memory\n");
*idata = *data;
hashtable_rc_t ret = hashtable_insert(du2cu_ue_mapping, key, idata);
pthread_mutex_unlock(&du2cu_mutex);
......
......@@ -2643,13 +2643,19 @@ uint16_t get_nr_srs_offset(NR_SRS_PeriodicityAndOffset_t periodicityAndOffset) {
// - "UE procedure for applying transform precoding on PUSCH"
long get_transformPrecoding(const NR_UE_UL_BWP_t *current_UL_BWP, nr_dci_format_t dci_format, uint8_t configuredGrant)
{
if (configuredGrant && current_UL_BWP->configuredGrantConfig && current_UL_BWP->configuredGrantConfig->transformPrecoder)
if (configuredGrant
&& current_UL_BWP
&& current_UL_BWP->configuredGrantConfig
&& current_UL_BWP->configuredGrantConfig->transformPrecoder)
return *current_UL_BWP->configuredGrantConfig->transformPrecoder;
if (dci_format == NR_UL_DCI_FORMAT_0_1 && current_UL_BWP && current_UL_BWP->pusch_Config && current_UL_BWP->pusch_Config->transformPrecoder)
if (dci_format == NR_UL_DCI_FORMAT_0_1
&& current_UL_BWP
&& current_UL_BWP->pusch_Config
&& current_UL_BWP->pusch_Config->transformPrecoder)
return *current_UL_BWP->pusch_Config->transformPrecoder;
if (current_UL_BWP->rach_ConfigCommon && current_UL_BWP->rach_ConfigCommon->msg3_transformPrecoder)
if (current_UL_BWP && current_UL_BWP->rach_ConfigCommon && current_UL_BWP->rach_ConfigCommon->msg3_transformPrecoder)
return NR_PUSCH_Config__transformPrecoder_enabled;
return NR_PUSCH_Config__transformPrecoder_disabled;
......@@ -2657,8 +2663,8 @@ long get_transformPrecoding(const NR_UE_UL_BWP_t *current_UL_BWP, nr_dci_format_
uint8_t get_pusch_nb_antenna_ports(NR_PUSCH_Config_t *pusch_Config,
NR_SRS_Config_t *srs_config,
dci_field_t srs_resource_indicator) {
dci_field_t srs_resource_indicator)
{
uint8_t n_antenna_port = 1;
if (get_softmodem_params()->phy_test == 1) {
// temporary hack to allow UL-MIMO in phy-test mode without SRS
......@@ -2674,7 +2680,7 @@ uint8_t get_pusch_nb_antenna_ports(NR_PUSCH_Config_t *pusch_Config,
// shall be configured with the same value for all these SRS resources.
if (srs_resource_set->usage == NR_SRS_ResourceSet__usage_codebook) {
NR_SRS_Resource_t *srs_resource = srs_config->srs_ResourceToAddModList->list.array[sri];
AssertFatal(srs_resource != NULL, "SRS resource indicated by DCI does not exist\n");
AssertFatal(srs_resource, "SRS resource indicated by DCI does not exist\n");
n_antenna_port = 1 << srs_resource->nrofSRS_Ports;
break;
}
......@@ -2806,8 +2812,8 @@ uint8_t compute_precoding_information(NR_PUSCH_Config_t *pusch_Config,
dci_field_t srs_resource_indicator,
nr_srs_feedback_t *srs_feedback,
const uint8_t *nrOfLayers,
uint32_t *val) {
uint32_t *val)
{
// It is only applicable to codebook based transmission. This field occupies 0 bits for non-codebook based
// transmission. It also occupies 0 bits for codebook based transmission using a single antenna port.
uint8_t nbits = 0;
......@@ -2816,8 +2822,9 @@ uint8_t compute_precoding_information(NR_PUSCH_Config_t *pusch_Config,
}
uint8_t pusch_antenna_ports = get_pusch_nb_antenna_ports(pusch_Config, srs_config, srs_resource_indicator);
if ((pusch_Config && pusch_Config->txConfig != NULL && *pusch_Config->txConfig == NR_PUSCH_Config__txConfig_nonCodebook) ||
pusch_antenna_ports == 1) {
if (!pusch_Config
|| (pusch_Config->txConfig != NULL && *pusch_Config->txConfig == NR_PUSCH_Config__txConfig_nonCodebook)
|| pusch_antenna_ports == 1) {
return nbits;
}
......@@ -3041,7 +3048,6 @@ uint8_t compute_precoding_information(NR_PUSCH_Config_t *pusch_Config,
}
}
return nbits;
}
......
......@@ -74,6 +74,7 @@ void init_RA(NR_UE_MAC_INST_t *mac,
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
prach_resources->RA_PREAMBLE_BACKOFF = 0;
AssertFatal(nr_rach_ConfigCommon, "Cannot handle scenario without nr_rach_ConfigCommon\n");
NR_SubcarrierSpacing_t prach_scs = *nr_rach_ConfigCommon->msg1_SubcarrierSpacing;
int n_prbs = get_N_RA_RB(prach_scs, mac->current_UL_BWP->scs);
int start_prb = rach_ConfigGeneric->msg1_FrequencyStart + mac->current_UL_BWP->BWPStart;
......@@ -100,12 +101,10 @@ void init_RA(NR_UE_MAC_INST_t *mac,
} else {
LOG_E(NR_MAC, "Config not handled\n");
}
} else if (nr_rach_ConfigCommon){
} else {
LOG_I(NR_MAC, "Initialization of 4-step contention-based random access procedure\n");
prach_resources->RA_TYPE = RA_4STEP;
ra->cfra = 0;
} else {
LOG_E(NR_MAC, "Config not handled\n");
}
switch (rach_ConfigGeneric->powerRampingStep){ // in dB
......
......@@ -652,7 +652,7 @@ static void nr_generate_Msg3_retransmission(module_id_t module_idP,
// generation of DCI 0_0 to schedule msg3 retransmission
NR_SearchSpace_t *ss = ra->ra_ss;
NR_ControlResourceSet_t *coreset = ra->coreset;
AssertFatal(coreset!=NULL,"Coreset cannot be null for RA-Msg3 retransmission\n");
AssertFatal(coreset, "Coreset cannot be null for RA-Msg3 retransmission\n");
const int coresetid = coreset->controlResourceSetId;
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][coresetid];
......@@ -1251,7 +1251,7 @@ static void nr_generate_Msg2(module_id_t module_idP,
}
NR_ControlResourceSet_t *coreset = ra->coreset;
AssertFatal(coreset != NULL, "Coreset cannot be null for RA-Msg2\n");
AssertFatal(coreset, "Coreset cannot be null for RA-Msg2\n");
const int coresetid = coreset->controlResourceSetId;
// Calculate number of symbols
int time_domain_assignment = get_dl_tda(nr_mac, scc, slotP);
......
......@@ -1071,9 +1071,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
if (nr_get_code_rate_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx) != R) {
pdsch_pdu->mcsTable[0] = 0;
}
AssertFatal(harq!=NULL,"harq is null\n");
AssertFatal(harq->round<gNB_mac->dl_bler.harq_round_max,"%d",harq->round);
pdsch_pdu->rvIndex[0] = nr_rv_round_map[harq->round%4];
AssertFatal(harq->round < gNB_mac->dl_bler.harq_round_max,"%d", harq->round);
pdsch_pdu->rvIndex[0] = nr_rv_round_map[harq->round % 4];
pdsch_pdu->TBSize[0] = TBS;
pdsch_pdu->dataScramblingId = *scc->physCellId;
pdsch_pdu->nrOfLayers = nrOfLayers;
......
......@@ -954,10 +954,10 @@ static uint8_t get_max_tpmi(const NR_PUSCH_Config_t *pusch_Config,
{
uint8_t max_tpmi = 0;
if ((pusch_Config && pusch_Config->txConfig != NULL && *pusch_Config->txConfig == NR_PUSCH_Config__txConfig_nonCodebook) ||
num_ue_srs_ports == 1) {
if (!pusch_Config
|| (pusch_Config->txConfig != NULL && *pusch_Config->txConfig == NR_PUSCH_Config__txConfig_nonCodebook)
|| num_ue_srs_ports == 1)
return max_tpmi;
}
long max_rank = *pusch_Config->maxRank;
long *ul_FullPowerTransmission = pusch_Config->ext1 ? pusch_Config->ext1->ul_FullPowerTransmission_r16 : NULL;
......@@ -1963,7 +1963,7 @@ static bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_
const NR_SIB1_t *sib1 = nr_mac->common_channels[0].sib1 ? nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL;
NR_ServingCellConfigCommonSIB_t *scc_sib1 = sib1 ? sib1->servingCellConfigCommon : NULL;
AssertFatal(scc!=NULL || scc_sib1!=NULL,"We need one serving cell config common\n");
AssertFatal(scc || scc_sib1, "We need one serving cell config common\n");
// no UEs
if (nr_mac->UE_info.list[0] == NULL)
......
......@@ -260,7 +260,7 @@ static int handle_ue_context_drbs_release(int rnti,
newGtpuDeleteOneTunnel(f1inst, rnti, drb->rb_id);
asn_sequence_del(&cellGroupConfig->rlc_BearerToAddModList->list, idx, 1);
long *plcid = malloc(sizeof(*plcid));
AssertFatal(plcid != NULL, "out of memory\n");
AssertFatal(plcid, "out of memory\n");
*plcid = lcid;
int ret = ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToReleaseList->list, plcid);
DevAssert(ret == 0);
......@@ -392,7 +392,7 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req)
NR_SCHED_LOCK(&mac->sched_lock);
NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[0]->UE_info, req->gNB_DU_ue_id);
AssertFatal(UE != NULL, "did not find UE with RNTI %04x, but UE Context Setup Failed not implemented\n", req->gNB_DU_ue_id);
AssertFatal(UE, "did not find UE with RNTI %04x, but UE Context Setup Failed not implemented\n", req->gNB_DU_ue_id);
NR_CellGroupConfig_t *new_CellGroup = clone_CellGroupConfig(UE->CellGroup);
......
......@@ -45,17 +45,17 @@ static void f1_setup_request_direct(const f1ap_setup_req_t *req)
if (req->cell[n].sys_info) {
f1ap_gnb_du_system_info_t *orig_sys_info = req->cell[n].sys_info;
f1ap_gnb_du_system_info_t *copy_sys_info = calloc(1, sizeof(*copy_sys_info));
AssertFatal(copy_sys_info != NULL, "out of memory\n");
AssertFatal(copy_sys_info, "out of memory\n");
f1ap_msg->cell[n].sys_info = copy_sys_info;
copy_sys_info->mib = calloc(orig_sys_info->mib_length, sizeof(uint8_t));
AssertFatal(copy_sys_info->mib != NULL, "out of memory\n");
AssertFatal(copy_sys_info->mib, "out of memory\n");
memcpy(copy_sys_info->mib, orig_sys_info->mib, orig_sys_info->mib_length);
copy_sys_info->mib_length = orig_sys_info->mib_length;
if (orig_sys_info->sib1_length > 0) {
copy_sys_info->sib1 = calloc(orig_sys_info->sib1_length, sizeof(uint8_t));
AssertFatal(copy_sys_info->sib1 != NULL, "out of memory\n");
AssertFatal(copy_sys_info->sib1, "out of memory\n");
memcpy(copy_sys_info->sib1, orig_sys_info->sib1, orig_sys_info->sib1_length);
copy_sys_info->sib1_length = orig_sys_info->sib1_length;
}
......
......@@ -77,17 +77,17 @@ static void f1_setup_request_f1ap(const f1ap_setup_req_t *req)
if (req->cell[n].sys_info) {
f1ap_gnb_du_system_info_t *orig_sys_info = req->cell[n].sys_info;
f1ap_gnb_du_system_info_t *copy_sys_info = calloc(1, sizeof(*copy_sys_info));
AssertFatal(copy_sys_info != NULL, "out of memory\n");
AssertFatal(copy_sys_info, "out of memory\n");
f1ap_setup->cell[n].sys_info = copy_sys_info;
copy_sys_info->mib = calloc(orig_sys_info->mib_length, sizeof(uint8_t));
AssertFatal(copy_sys_info->mib != NULL, "out of memory\n");
AssertFatal(copy_sys_info->mib, "out of memory\n");
memcpy(copy_sys_info->mib, orig_sys_info->mib, orig_sys_info->mib_length);
copy_sys_info->mib_length = orig_sys_info->mib_length;
if (orig_sys_info->sib1_length > 0) {
copy_sys_info->sib1 = calloc(orig_sys_info->sib1_length, sizeof(uint8_t));
AssertFatal(copy_sys_info->sib1 != NULL, "out of memory\n");
AssertFatal(copy_sys_info->sib1, "out of memory\n");
memcpy(copy_sys_info->sib1, orig_sys_info->sib1, orig_sys_info->sib1_length);
copy_sys_info->sib1_length = orig_sys_info->sib1_length;
}
......
......@@ -116,7 +116,7 @@ static int drb_gtpu_create(instance_t instance,
static instance_t get_n3_gtp_instance(void)
{
const e1ap_upcp_inst_t *inst = getCxtE1(0);
AssertFatal(inst != NULL, "need to have E1 instance\n");
AssertFatal(inst, "need to have E1 instance\n");
return inst->gtpInstN3;
}
......
......@@ -36,7 +36,7 @@ void *nr_pdcp_integrity_nia2_init(uint8_t integrity_key[16])
// No. The overhead is x8 times more. Don't change before measuring
// return integrity_key;
cbc_cmac_ctx_t* ctx = calloc(1, sizeof(cbc_cmac_ctx_t));
AssertFatal(ctx != NULL, "Memory exhausted");
AssertFatal(ctx, "Memory exhausted");
*ctx = init_aes_128_cbc_cmac(integrity_key);
return ctx;
......
......@@ -962,7 +962,7 @@ void nr_rlc_activate_srb0(int ue_id,
void (*send_initial_ul_rrc_message)(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data))
{
struct srb0_data *srb0_data = calloc(1, sizeof(struct srb0_data));
AssertFatal(srb0_data != NULL, "out of memory\n");
AssertFatal(srb0_data, "out of memory\n");
srb0_data->ue_id = ue_id;
srb0_data->data = data;
......
......@@ -1148,10 +1148,11 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info)
static uint32_t nr_ue_dl_processing(nr_downlink_indication_t *dl_info)
{
uint32_t ret_mask = 0x0;
DevAssert(dl_info != NULL);
NR_UE_MAC_INST_t *mac = get_mac_inst(dl_info->module_id);
// DL indication after reception of DCI or DL PDU
if (dl_info && dl_info->dci_ind && dl_info->dci_ind->number_of_dcis) {
if (dl_info->dci_ind && dl_info->dci_ind->number_of_dcis) {
LOG_T(MAC, "[L2][IF MODULE][DL INDICATION][DCI_IND]\n");
for (int i = 0; i < dl_info->dci_ind->number_of_dcis; i++) {
LOG_T(MAC, ">>>NR_IF_Module i=%d, dl_info->dci_ind->number_of_dcis=%d\n", i, dl_info->dci_ind->number_of_dcis);
......
......@@ -2580,7 +2580,7 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
struct NR_ServingCellConfig__downlinkBWP_ToAddModList *DL_BWP_list =
SpCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList;
struct NR_UplinkConfig__uplinkBWP_ToAddModList *UL_BWP_list = uplinkConfig->uplinkBWP_ToAddModList;
struct NR_UplinkConfig__uplinkBWP_ToAddModList *UL_BWP_list = uplinkConfig ? uplinkConfig->uplinkBWP_ToAddModList : NULL;
if (DL_BWP_list) {
for (int i = 0; i < DL_BWP_list->list.count; i++) {
NR_BWP_Downlink_t *bwp = DL_BWP_list->list.array[i];
......@@ -2675,7 +2675,8 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC
const int dl_antenna_ports = pdschap->N1 * pdschap->N2 * pdschap->XP;
const int do_csirs = configuration->do_CSIRS;
AssertFatal(servingcellconfigcommon != NULL, "servingcellconfigcommon is null\n");
AssertFatal(servingcellconfigcommon, "servingcellconfigcommon is null\n");
AssertFatal(servingcellconfigdedicated, "servingcellconfigdedicated is null\n");
if (uecap == NULL)
LOG_E(RRC, "No UE Capabilities available when programming default CellGroup in NSA\n");
......@@ -2803,7 +2804,7 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC
// Downlink BWPs
int n_dl_bwp = 1;
if (servingcellconfigdedicated && servingcellconfigdedicated->downlinkBWP_ToAddModList) {
if (servingcellconfigdedicated->downlinkBWP_ToAddModList) {
n_dl_bwp = servingcellconfigdedicated->downlinkBWP_ToAddModList->list.count;
}
if (n_dl_bwp > 0) {
......@@ -2833,8 +2834,7 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC
// Uplink BWPs
int n_ul_bwp = 1;
if (servingcellconfigdedicated && servingcellconfigdedicated->uplinkConfig
&& servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList) {
if (servingcellconfigdedicated->uplinkConfig && servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList) {
n_ul_bwp = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count;
}
if (n_ul_bwp > 0) {
......
......@@ -146,14 +146,14 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id)
// we accept the DU
nr_rrc_du_container_t *du = calloc(1, sizeof(*du));
AssertFatal(du != NULL, "out of memory\n");
AssertFatal(du, "out of memory\n");
du->assoc_id = assoc_id;
/* ITTI will free the setup request message via free(). So the memory
* "inside" of the message will remain, but the "outside" container no, so
* allocate memory and copy it in */
du->setup_req = calloc(1,sizeof(*du->setup_req));
AssertFatal(du->setup_req != NULL, "out of memory\n");
AssertFatal(du->setup_req, "out of memory\n");
*du->setup_req = *req;
if (mib != NULL && sib1 != NULL) {
du->mib = mib->message.choice.mib;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment