nullPointerRedundantCheck

This commit is contained in:
francescomani
2024-04-09 16:55:51 +02:00
parent ddf3b1614c
commit 8404da759f
28 changed files with 78 additions and 75 deletions
+2 -3
View File
@@ -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;
+7 -7
View File
@@ -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);
}
+1 -1
View File
@@ -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;
+1 -2
View File
@@ -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();
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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;
+5 -3
View File
@@ -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 */
/*------------------------------------------------------------------------------------------------------------------*/