Fixed Coverity INFO/DEBUG messages with too many arguments and a few more

This commit is contained in:
Xavier Arteaga 2018-01-31 12:43:22 +01:00
parent d500bdbc24
commit 10fc1855d6
22 changed files with 58 additions and 44 deletions

View File

@ -239,7 +239,7 @@ int main(int argc, char **argv) {
exit(-1);
}
INFO("Stopping RF and flushing buffer...\n",0);
INFO("Stopping RF and flushing buffer...\n");
srslte_rf_stop_rx_stream(&rf);
srslte_rf_flush_buffer(&rf);

View File

@ -220,7 +220,7 @@ int main(int argc, char **argv) {
INFO("Setting sampling frequency %.2f MHz for PSS search\n", SRSLTE_CS_SAMP_FREQ/1000000);
srslte_rf_set_rx_srate(&rf, SRSLTE_CS_SAMP_FREQ);
INFO("Starting receiver...\n", 0);
INFO("Starting receiver...\n");
srslte_rf_start_rx_stream(&rf, false);
n = srslte_ue_cellsearch_scan(&cs, found_cells, NULL);

View File

@ -858,7 +858,7 @@ int main(int argc, char **argv) {
if (net_port > 0) {
send_data = net_packet_ready;
if (net_packet_ready) {
INFO("Transmitting packet\n",0);
INFO("Transmitting packet\n");
}
} else {
INFO("SF: %d, Generating %d random bits\n", sf_idx, pdsch_cfg.grant.mcs[0].tbs + pdsch_cfg.grant.mcs[1].tbs);

View File

@ -473,7 +473,7 @@ int main(int argc, char **argv) {
exit(-1);
}
INFO("Stopping RF and flushing buffer...\r",0);
INFO("Stopping RF and flushing buffer...\r");
}
#endif
@ -606,7 +606,7 @@ int main(int argc, char **argv) {
srslte_pbch_decode_reset(&ue_mib.pbch);
INFO("\nEntering main loop...\n\n", 0);
INFO("\nEntering main loop...\n\n");
/* Main loop */
while (!go_exit && (sf_cnt < prog_args.nof_subframes || prog_args.nof_subframes == -1)) {
bool acks [SRSLTE_MAX_CODEWORDS] = {false};

View File

@ -50,7 +50,9 @@ void srslte_filesource_free(srslte_filesource_t *q) {
}
void srslte_filesource_seek(srslte_filesource_t *q, int pos) {
fseek(q->f, pos, SEEK_SET);
if (!fseek(q->f, pos, SEEK_SET)){
perror("srslte_filesource_seek");
}
}
int read_complex_f(FILE *f, _Complex float *y) {

View File

@ -2205,7 +2205,9 @@ int srslte_precoding_pmi_select_2l_gen(cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORT
}
/* Divide average by noise */
sinr_list[i] /= count;
if (count) {
sinr_list[i] /= count;
}
if (sinr_list[i] > max_sinr) {
max_sinr = sinr_list[i];
@ -2326,7 +2328,9 @@ int srslte_precoding_pmi_select_2l_sse(cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORT
}
/* Divide average by noise */
sinr_list[i] /= count;
if (count) {
sinr_list[i] /= count;
}
if (sinr_list[i] > max_sinr) {
max_sinr = sinr_list[i];
@ -2473,7 +2477,9 @@ int srslte_precoding_pmi_select_2l_avx(cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORT
}
/* Divide average by noise */
sinr_list[i] /= count;
if (count) {
sinr_list[i] /= count;
}
if (sinr_list[i] > max_sinr) {
max_sinr = sinr_list[i];
@ -2545,7 +2551,11 @@ float srslte_precoding_2x2_cn_gen(cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS], u
count++;
}
return cn_avg/count;
if (count) {
cn_avg /= count;
}
return cn_avg;
}
/* Computes the condition number for a given number of antennas,

View File

@ -124,7 +124,7 @@ int main(int argc, char **argv) {
/* Condition number */
if (srslte_precoding_cn(h, 2, 2, nof_symbols, &cn)) {
ERROR("Test case %d condition number returned error\n");
ERROR("Test case %d condition number returned error\n", c + 1);
goto clean;
}

View File

@ -42,7 +42,7 @@ int nof_symbols = 1000;
uint32_t codebook_idx = 0;
int nof_layers = 1, nof_tx_ports = 1, nof_rx_ports = 1, nof_re = 1;
char *mimo_type_name = NULL;
char decoder_type_name [16] = "zf";
char decoder_type_name [17] = "zf";
float snr_db = 100.0f;
float scaling = 0.1f;
@ -56,7 +56,7 @@ void usage(char *prog) {
printf("\t-g Scaling [Default %.1f]*\n", scaling);
printf("\t-d decoder type [zf|mmse] [Default %s]\n", decoder_type_name);
printf("\n");
printf("* Performance test example:\n\t for snr in {0..20..1}; do ./precoding_test -m single -s $snr; done; \n\n", decoder_type_name);
printf("* Performance test example:\n\t for snr in {0..20..1}; do ./precoding_test -m single -s $snr; done; \n\n");
}
void parse_args(int argc, char **argv) {

View File

@ -383,7 +383,7 @@ bool srslte_ri_send(uint32_t I_cqi_pmi, uint32_t I_ri, uint32_t tti) {
return false;
}
if (M_ri) {
if (M_ri && N_p) {
if ((tti - N_offset_p + N_offset_ri) % (N_p * M_ri) == 0) {
return true;
}

View File

@ -577,7 +577,7 @@ int dci_format0_unpack(srslte_dci_msg_t *msg, srslte_ra_ul_dci_t *data, uint32_t
return SRSLTE_ERROR;
}
if (*y++ != 0) {
INFO("DCI message is Format1A\n", 0);
INFO("DCI message is Format1A\n");
return SRSLTE_ERROR;
}
if (*y++ == 0) {
@ -836,7 +836,7 @@ int dci_format1As_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32
}
if (*y++ != 1) {
INFO("DCI message is Format0\n", 0);
INFO("DCI message is Format0\n");
return SRSLTE_ERROR;
}

View File

@ -557,7 +557,7 @@ int srslte_pdcch_dci_encode(srslte_pdcch_t *q, uint8_t *data, uint8_t *e, uint32
srslte_pdcch_dci_encode_conv(q, data, nof_bits, tmp, rnti);
DEBUG("CConv output: ", 0);
DEBUG("CConv output: ");
if (SRSLTE_VERBOSE_ISDEBUG()) {
srslte_vec_fprint_b(stdout, tmp, 3 * (nof_bits + 16));
}
@ -617,7 +617,7 @@ int srslte_pdcch_encode(srslte_pdcch_t *q, srslte_dci_msg_t *msg, srslte_dci_loc
srslte_scrambling_b_offset(&q->seq[nsubframe], q->e, 72 * location.ncce, e_bits);
DEBUG("Scrambling output: ", 0);
DEBUG("Scrambling output: ");
if (SRSLTE_VERBOSE_ISDEBUG()) {
srslte_vec_fprint_b(stdout, q->e, e_bits);
}

View File

@ -29,6 +29,8 @@
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <srslte/phy/phch/pdsch_cfg.h>
#include <srslte/srslte.h>
#include "prb_dl.h"
#include "srslte/phy/phch/pdsch.h"
@ -656,8 +658,8 @@ int srslte_pdsch_decode(srslte_pdsch_t *q,
{
uint32_t nof_tb = SRSLTE_RA_DL_GRANT_NOF_TB(&cfg->grant);
INFO("Decoding PDSCH SF: %d, RNTI: 0x%x, NofSymbols: %d, C_prb=%d, mimo_type=%d, nof_layers=%d, nof_tb=%d\n",
cfg->sf_idx, rnti, cfg->nbits[0].nof_re, cfg->grant.nof_prb, cfg->nof_layers, nof_tb);
INFO("Decoding PDSCH SF: %d, RNTI: 0x%x, NofSymbols: %d, C_prb=%d, mimo_type=%s, nof_layers=%d, nof_tb=%d\n",
cfg->sf_idx, rnti, cfg->nbits[0].nof_re, cfg->grant.nof_prb, srslte_mod_string(cfg->grant.mcs->mod), cfg->nof_layers, nof_tb);
// Extract Symbols and Channel Estimates
for (int j=0;j<q->nof_rx_antennas;j++) {

View File

@ -148,7 +148,7 @@ uint8_t srslte_phich_ack_decode(float bits[SRSLTE_PHICH_NBITS], float *distance)
uint8_t index=0;
if (SRSLTE_VERBOSE_ISINFO()) {
INFO("Received bits: ", 0);
INFO("Received bits: ");
srslte_vec_fprint_f(stdout, bits, SRSLTE_PHICH_NBITS);
}
@ -244,8 +244,8 @@ int srslte_phich_decode(srslte_phich_t *q, cf_t *sf_symbols[SRSLTE_MAX_PORTS],
srslte_predecoding_diversity_multi(q_sf_symbols, q_ce, x, q->nof_rx_antennas, q->cell.nof_ports, SRSLTE_PHICH_MAX_NSYMB, 1.0f);
srslte_layerdemap_diversity(x, q->d0, q->cell.nof_ports, SRSLTE_PHICH_MAX_NSYMB / q->cell.nof_ports);
}
DEBUG("Recv!!: \n", 0);
DEBUG("d0: ", 0);
DEBUG("Recv!!: \n");
DEBUG("d0: ");
if (SRSLTE_VERBOSE_ISDEBUG())
srslte_vec_fprint_c(stdout, q->d0, SRSLTE_PHICH_MAX_NSYMB);
@ -265,7 +265,7 @@ int srslte_phich_decode(srslte_phich_t *q, cf_t *sf_symbols[SRSLTE_MAX_PORTS],
memcpy(q->d, q->d0, SRSLTE_PHICH_MAX_NSYMB * sizeof(cf_t));
}
DEBUG("d: ", 0);
DEBUG("d: ");
if (SRSLTE_VERBOSE_ISDEBUG())
srslte_vec_fprint_c(stdout, q->d, SRSLTE_PHICH_EXT_MSYMB);
@ -290,7 +290,7 @@ int srslte_phich_decode(srslte_phich_t *q, cf_t *sf_symbols[SRSLTE_MAX_PORTS],
}
}
DEBUG("z: ", 0);
DEBUG("z: ");
if (SRSLTE_VERBOSE_ISDEBUG())
srslte_vec_fprint_c(stdout, q->z, SRSLTE_PHICH_NBITS);
@ -353,7 +353,7 @@ int srslte_phich_encode(srslte_phich_t *q, uint8_t ack, uint32_t ngroup, uint32_
srslte_mod_modulate(&q->mod, q->data, q->z, SRSLTE_PHICH_NBITS);
DEBUG("data: ", 0);
DEBUG("data: ");
if (SRSLTE_VERBOSE_ISDEBUG())
srslte_vec_fprint_c(stdout, q->z, SRSLTE_PHICH_NBITS);
@ -370,7 +370,7 @@ int srslte_phich_encode(srslte_phich_t *q, uint8_t ack, uint32_t ngroup, uint32_
}
}
DEBUG("d: ", 0);
DEBUG("d: ");
if (SRSLTE_VERBOSE_ISDEBUG())
srslte_vec_fprint_c(stdout, q->d, SRSLTE_PHICH_EXT_MSYMB);
@ -397,7 +397,7 @@ int srslte_phich_encode(srslte_phich_t *q, uint8_t ack, uint32_t ngroup, uint32_
memcpy(q->d0, q->d, SRSLTE_PHICH_MAX_NSYMB * sizeof(cf_t));
}
DEBUG("d0: ", 0);
DEBUG("d0: ");
if (SRSLTE_VERBOSE_ISDEBUG())
srslte_vec_fprint_c(stdout, q->d0, SRSLTE_PHICH_MAX_NSYMB);

View File

@ -494,7 +494,7 @@ static int decode_tb(srslte_sch_t *q,
((uint32_t) data[cb_segm->tbs/8+2]);
if (par_rx == par_tx && par_rx) {
INFO("TB decoded OK\n",0);
INFO("TB decoded OK\n");
return SRSLTE_SUCCESS;
} else {
INFO("Error in TB parity: par_tx=0x%x, par_rx=0x%x\n", par_tx, par_rx);

View File

@ -154,7 +154,7 @@ int base_init() {
return -1;
}
DEBUG("Memory init OK\n",0);
DEBUG("Memory init OK\n");
return 0;
}

View File

@ -170,7 +170,7 @@ int base_init() {
return -1;
}
DEBUG("Memory init OK\n",0);
DEBUG("Memory init OK\n");
return 0;
}
@ -232,7 +232,7 @@ int main(int argc, char **argv) {
/* Get channel estimates for each port */
srslte_chest_dl_estimate(&chest, fft_buffer, ce, 0);
INFO("Decoding PCFICH\n", 0);
INFO("Decoding PCFICH\n");
n = srslte_pcfich_decode(&pcfich, fft_buffer, ce, srslte_chest_dl_get_noise_estimate(&chest), 0, &cfi, &cfi_corr);

View File

@ -180,7 +180,7 @@ int base_init() {
exit(-1);
}
DEBUG("Memory init OK\n",0);
DEBUG("Memory init OK\n");
return 0;
}
@ -244,7 +244,7 @@ int main(int argc, char **argv) {
return -1;
}
if (rnti == SRSLTE_SIRNTI) {
INFO("Initializing common search space for SI-RNTI\n",0);
INFO("Initializing common search space for SI-RNTI\n");
nof_locations = srslte_pdcch_common_locations(&pdcch, locations, MAX_CANDIDATES, cfi);
} else {
INFO("Initializing user-specific search space for RNTI: 0x%x\n", rnti);

View File

@ -148,7 +148,7 @@ int base_init() {
srslte_ue_dl_set_rnti(&ue_dl, rnti);
DEBUG("Memory init OK\n",0);
DEBUG("Memory init OK\n");
return 0;
}

View File

@ -194,7 +194,7 @@ int base_init() {
return -1;
}
DEBUG("Memory init OK\n",0);
DEBUG("Memory init OK\n");
return 0;
}
@ -257,7 +257,7 @@ int main(int argc, char **argv) {
/* Get channel estimates for each port */
srslte_chest_dl_estimate(&chest, fft_buffer, ce, 0);
INFO("Decoding PHICH\n", 0);
INFO("Decoding PHICH\n");
/* Receive all PHICH groups and sequence numbers */
for (ngroup=0;ngroup<srslte_phich_ngroups(&phich);ngroup++) {

View File

@ -368,14 +368,14 @@ int encode_cqi_long(srslte_uci_cqi_pusch_t *q, uint8_t *data, uint32_t nof_bits,
memcpy(q->tmp_cqi, data, sizeof(uint8_t) * nof_bits);
srslte_crc_attach(&q->crc, q->tmp_cqi, nof_bits);
DEBUG("cqi_crc_tx=", 0);
DEBUG("cqi_crc_tx=");
if (SRSLTE_VERBOSE_ISDEBUG()) {
srslte_vec_fprint_b(stdout, q->tmp_cqi, nof_bits+8);
}
srslte_convcoder_encode(&encoder, q->tmp_cqi, q->encoded_cqi, nof_bits + 8);
DEBUG("cconv_tx=", 0);
DEBUG("cconv_tx=");
if (SRSLTE_VERBOSE_ISDEBUG()) {
srslte_vec_fprint_b(stdout, q->encoded_cqi, 3 * (nof_bits + 8));
}
@ -400,14 +400,14 @@ int decode_cqi_long(srslte_uci_cqi_pusch_t *q, int16_t *q_bits, uint32_t Q,
srslte_rm_conv_rx_s(q_bits, Q, q->encoded_cqi_s, 3 * (nof_bits + 8));
DEBUG("cconv_rx=", 0);
DEBUG("cconv_rx=");
if (SRSLTE_VERBOSE_ISDEBUG()) {
srslte_vec_fprint_s(stdout, q->encoded_cqi_s, 3 * (nof_bits + 8));
}
srslte_viterbi_decode_s(&q->viterbi, q->encoded_cqi_s, q->tmp_cqi, nof_bits + 8);
DEBUG("cqi_crc_rx=", 0);
DEBUG("cqi_crc_rx=");
if (SRSLTE_VERBOSE_ISDEBUG()) {
srslte_vec_fprint_b(stdout, q->tmp_cqi, nof_bits+8);
}

View File

@ -117,7 +117,7 @@ int rf_mib_decoder(srslte_rf_t *rf, uint32_t nof_rx_antennas,cell_search_cfg_t *
INFO("Setting sampling frequency %.2f MHz for PSS search\n", (float) srate/1000000);
srslte_rf_set_rx_srate(rf, (float) srate);
INFO("Starting receiver...\n", 0);
INFO("Starting receiver...\n");
srslte_rf_start_rx_stream(rf, false);
// Copy CFO estimate if provided and disable CP estimation during find
@ -174,7 +174,7 @@ int rf_cell_search(srslte_rf_t *rf, uint32_t nof_rx_antennas,
INFO("Setting sampling frequency %.2f MHz for PSS search\n", SRSLTE_CS_SAMP_FREQ/1000000);
srslte_rf_set_rx_srate(rf, SRSLTE_CS_SAMP_FREQ);
INFO("Starting receiver...\n", 0);
INFO("Starting receiver...\n");
srslte_rf_start_rx_stream(rf, false);
/* Find a cell in the given N_id_2 or go through the 3 of them to find the strongest */

View File

@ -751,7 +751,7 @@ int srslte_ue_sync_zerocopy_multi(srslte_ue_sync_t *q, cf_t *input_buffer[SRSLTE
break;
case SRSLTE_SYNC_FOUND_NOSPACE:
/* If a peak was found but there is not enough space for SSS/CP detection, discard a few samples */
INFO("No space for SSS/CP detection. Realigning frame...\n",0);
INFO("No space for SSS/CP detection. Realigning frame...\n");
q->recv_callback(q->stream, dummy_offset_buffer, q->frame_len/2, NULL);
srslte_sync_reset(&q->sfind);
ret = SRSLTE_SUCCESS;