Fixed coverity 369716

master
AlaiaL 4 years ago committed by Andre Puschmann
parent 862784ee46
commit 23f0bd4d4f

@ -450,7 +450,7 @@ bool make_phy_csi_report(const csi_report_cfg_s& csi_report_cfg,
return false; return false;
} }
if (srsran_csi_hl_report_cfg.type = SRSRAN_CSI_REPORT_TYPE_PERIODIC) { if (srsran_csi_hl_report_cfg.type == SRSRAN_CSI_REPORT_TYPE_PERIODIC) {
srsran_csi_hl_report_cfg.periodic.period = srsran_csi_hl_report_cfg.periodic.period =
csi_report_cfg.report_cfg_type.periodic().report_slot_cfg.type().to_number(); csi_report_cfg.report_cfg_type.periodic().report_slot_cfg.type().to_number();
switch (csi_report_cfg.report_cfg_type.periodic().report_slot_cfg.type()) { switch (csi_report_cfg.report_cfg_type.periodic().report_slot_cfg.type()) {
@ -577,7 +577,7 @@ bool make_phy_csi_report(const csi_report_cfg_s& csi_report_cfg,
bool make_phy_coreset_cfg(const ctrl_res_set_s& ctrl_res_set, srsran_coreset_t* in_srsran_coreset) bool make_phy_coreset_cfg(const ctrl_res_set_s& ctrl_res_set, srsran_coreset_t* in_srsran_coreset)
{ {
srsran_coreset_t srsran_coreset = {}; srsran_coreset_t srsran_coreset = {};
srsran_coreset.id = ctrl_res_set.ctrl_res_set_id; srsran_coreset.id = ctrl_res_set.ctrl_res_set_id;
switch (ctrl_res_set.precoder_granularity) { switch (ctrl_res_set.precoder_granularity) {
case ctrl_res_set_s::precoder_granularity_opts::same_as_reg_bundle: case ctrl_res_set_s::precoder_granularity_opts::same_as_reg_bundle:
srsran_coreset.precoder_granularity = srsran_coreset_precoder_granularity_reg_bundle; srsran_coreset.precoder_granularity = srsran_coreset_precoder_granularity_reg_bundle;
@ -940,77 +940,76 @@ bool make_phy_zp_csi_rs_resource(const asn1::rrc_nr::zp_csi_rs_res_s& zp_csi_rs_
} }
zp_csi_rs_resource.resource_mapping.freq_band.nof_rb = zp_csi_rs_res.res_map.freq_band.nrof_rbs; zp_csi_rs_resource.resource_mapping.freq_band.nof_rb = zp_csi_rs_res.res_map.freq_band.nrof_rbs;
zp_csi_rs_resource.resource_mapping.freq_band.start_rb = zp_csi_rs_res.res_map.freq_band.start_rb; zp_csi_rs_resource.resource_mapping.freq_band.start_rb = zp_csi_rs_res.res_map.freq_band.start_rb;
if(zp_csi_rs_res.periodicity_and_offset_present){ if (zp_csi_rs_res.periodicity_and_offset_present) {
switch (zp_csi_rs_res.periodicity_and_offset.type()) switch (zp_csi_rs_res.periodicity_and_offset.type()) {
{ case csi_res_periodicity_and_offset_c::types_opts::options::slots4:
case csi_res_periodicity_and_offset_c::types_opts::options::slots4: zp_csi_rs_resource.periodicity.period = 4;
zp_csi_rs_resource.periodicity.period = 4; zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots4();
zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots4(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots5:
case csi_res_periodicity_and_offset_c::types_opts::options::slots5: zp_csi_rs_resource.periodicity.period = 5;
zp_csi_rs_resource.periodicity.period = 5; zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots5();
zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots5(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots8:
case csi_res_periodicity_and_offset_c::types_opts::options::slots8: zp_csi_rs_resource.periodicity.period = 8;
zp_csi_rs_resource.periodicity.period = 8; zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots8();
zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots8(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots10:
case csi_res_periodicity_and_offset_c::types_opts::options::slots10: zp_csi_rs_resource.periodicity.period = 10;
zp_csi_rs_resource.periodicity.period = 10; zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots10();
zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots10(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots16:
case csi_res_periodicity_and_offset_c::types_opts::options::slots16: zp_csi_rs_resource.periodicity.period = 16;
zp_csi_rs_resource.periodicity.period = 16; zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots16();
zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots16(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots20:
case csi_res_periodicity_and_offset_c::types_opts::options::slots20: zp_csi_rs_resource.periodicity.period = 20;
zp_csi_rs_resource.periodicity.period = 20; zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots20();
zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots20(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots32:
case csi_res_periodicity_and_offset_c::types_opts::options::slots32: zp_csi_rs_resource.periodicity.period = 32;
zp_csi_rs_resource.periodicity.period = 32; zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots32();
zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots32(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots40:
case csi_res_periodicity_and_offset_c::types_opts::options::slots40: zp_csi_rs_resource.periodicity.period = 40;
zp_csi_rs_resource.periodicity.period = 40; zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots40();
zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots40(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots64:
case csi_res_periodicity_and_offset_c::types_opts::options::slots64: zp_csi_rs_resource.periodicity.period = 64;
zp_csi_rs_resource.periodicity.period = 64; zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots64();
zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots64(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots80:
case csi_res_periodicity_and_offset_c::types_opts::options::slots80: zp_csi_rs_resource.periodicity.period = 80;
zp_csi_rs_resource.periodicity.period = 80; zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots80();
zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots80(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots160:
case csi_res_periodicity_and_offset_c::types_opts::options::slots160: zp_csi_rs_resource.periodicity.period = 160;
zp_csi_rs_resource.periodicity.period = 160; zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots160();
zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots160(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots320:
case csi_res_periodicity_and_offset_c::types_opts::options::slots320: zp_csi_rs_resource.periodicity.period = 320;
zp_csi_rs_resource.periodicity.period = 320; zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots320();
zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots320(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots640:
case csi_res_periodicity_and_offset_c::types_opts::options::slots640: zp_csi_rs_resource.periodicity.period = 640;
zp_csi_rs_resource.periodicity.period = 640; zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots640();
zp_csi_rs_resource.periodicity.offset = zp_csi_rs_res.periodicity_and_offset.slots640(); break;
break; default:
default: asn1::log_warning("Invalid option for periodicity_and_offset %s",
asn1::log_warning("Invalid option for periodicity_and_offset %s", zp_csi_rs_res.periodicity_and_offset.type().to_string());
zp_csi_rs_res.periodicity_and_offset.type().to_string()); return false;
return false;
} }
} else { } else {
asn1::log_warning("Option periodicity_and_offset not present"); asn1::log_warning("Option periodicity_and_offset not present");
return false; return false;
} }
*out_zp_csi_rs_resource = zp_csi_rs_resource; *out_zp_csi_rs_resource = zp_csi_rs_resource;
return true; return true;
} }
bool make_phy_nzp_csi_rs_resource(const asn1::rrc_nr::nzp_csi_rs_res_s& asn1_nzp_csi_rs_res, bool make_phy_nzp_csi_rs_resource(const asn1::rrc_nr::nzp_csi_rs_res_s& asn1_nzp_csi_rs_res,
srsran_csi_rs_nzp_resource_t* out_csi_rs_nzp_resource) srsran_csi_rs_nzp_resource_t* out_csi_rs_nzp_resource)
{ {
srsran_csi_rs_nzp_resource_t csi_rs_nzp_resource; srsran_csi_rs_nzp_resource_t csi_rs_nzp_resource;
csi_rs_nzp_resource.id = asn1_nzp_csi_rs_res.nzp_csi_rs_res_id; csi_rs_nzp_resource.id = asn1_nzp_csi_rs_res.nzp_csi_rs_res_id;
@ -1019,24 +1018,24 @@ bool make_phy_nzp_csi_rs_resource(const asn1::rrc_nr::nzp_csi_rs_res_s& asn1_nz
csi_rs_nzp_resource.resource_mapping.row = srsran_csi_rs_resource_mapping_row_1; csi_rs_nzp_resource.resource_mapping.row = srsran_csi_rs_resource_mapping_row_1;
for (uint32_t i = 0; i < asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row1().length(); i++) { for (uint32_t i = 0; i < asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row1().length(); i++) {
csi_rs_nzp_resource.resource_mapping.frequency_domain_alloc[i] = csi_rs_nzp_resource.resource_mapping.frequency_domain_alloc[i] =
asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row1().get(asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row1().length() - asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row1().get(
1 - i); asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row1().length() - 1 - i);
} }
break; break;
case csi_rs_res_map_s::freq_domain_alloc_c_::types_opts::options::row2: case csi_rs_res_map_s::freq_domain_alloc_c_::types_opts::options::row2:
csi_rs_nzp_resource.resource_mapping.row = srsran_csi_rs_resource_mapping_row_2; csi_rs_nzp_resource.resource_mapping.row = srsran_csi_rs_resource_mapping_row_2;
for (uint32_t i = 0; i < asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row2().length(); i++) { for (uint32_t i = 0; i < asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row2().length(); i++) {
csi_rs_nzp_resource.resource_mapping.frequency_domain_alloc[i] = csi_rs_nzp_resource.resource_mapping.frequency_domain_alloc[i] =
asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row2().get(asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row2().length() - asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row2().get(
1 - i); asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row2().length() - 1 - i);
} }
break; break;
case csi_rs_res_map_s::freq_domain_alloc_c_::types_opts::options::row4: case csi_rs_res_map_s::freq_domain_alloc_c_::types_opts::options::row4:
csi_rs_nzp_resource.resource_mapping.row = srsran_csi_rs_resource_mapping_row_4; csi_rs_nzp_resource.resource_mapping.row = srsran_csi_rs_resource_mapping_row_4;
for (uint32_t i = 0; i < asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row4().length(); i++) { for (uint32_t i = 0; i < asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row4().length(); i++) {
csi_rs_nzp_resource.resource_mapping.frequency_domain_alloc[i] = csi_rs_nzp_resource.resource_mapping.frequency_domain_alloc[i] =
asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row4().get(asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row4().length() - asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row4().get(
1 - i); asn1_nzp_csi_rs_res.res_map.freq_domain_alloc.row4().length() - 1 - i);
} }
break; break;
case csi_rs_res_map_s::freq_domain_alloc_c_::types_opts::options::other: case csi_rs_res_map_s::freq_domain_alloc_c_::types_opts::options::other:
@ -1104,69 +1103,68 @@ bool make_phy_nzp_csi_rs_resource(const asn1::rrc_nr::nzp_csi_rs_res_s& asn1_nz
csi_rs_nzp_resource.power_control_offset_ss = asn1_nzp_csi_rs_res.pwr_ctrl_offset_ss.to_number(); csi_rs_nzp_resource.power_control_offset_ss = asn1_nzp_csi_rs_res.pwr_ctrl_offset_ss.to_number();
} }
if(asn1_nzp_csi_rs_res.periodicity_and_offset_present){ if (asn1_nzp_csi_rs_res.periodicity_and_offset_present) {
switch (asn1_nzp_csi_rs_res.periodicity_and_offset.type()) switch (asn1_nzp_csi_rs_res.periodicity_and_offset.type()) {
{ case csi_res_periodicity_and_offset_c::types_opts::options::slots4:
case csi_res_periodicity_and_offset_c::types_opts::options::slots4: csi_rs_nzp_resource.periodicity.period = 4;
csi_rs_nzp_resource.periodicity.period = 4; csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots4();
csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots4(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots5:
case csi_res_periodicity_and_offset_c::types_opts::options::slots5: csi_rs_nzp_resource.periodicity.period = 5;
csi_rs_nzp_resource.periodicity.period = 5; csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots5();
csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots5(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots8:
case csi_res_periodicity_and_offset_c::types_opts::options::slots8: csi_rs_nzp_resource.periodicity.period = 8;
csi_rs_nzp_resource.periodicity.period = 8; csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots8();
csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots8(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots10:
case csi_res_periodicity_and_offset_c::types_opts::options::slots10: csi_rs_nzp_resource.periodicity.period = 10;
csi_rs_nzp_resource.periodicity.period = 10; csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots10();
csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots10(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots16:
case csi_res_periodicity_and_offset_c::types_opts::options::slots16: csi_rs_nzp_resource.periodicity.period = 16;
csi_rs_nzp_resource.periodicity.period = 16; csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots16();
csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots16(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots20:
case csi_res_periodicity_and_offset_c::types_opts::options::slots20: csi_rs_nzp_resource.periodicity.period = 20;
csi_rs_nzp_resource.periodicity.period = 20; csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots20();
csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots20(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots32:
case csi_res_periodicity_and_offset_c::types_opts::options::slots32: csi_rs_nzp_resource.periodicity.period = 32;
csi_rs_nzp_resource.periodicity.period = 32; csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots32();
csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots32(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots40:
case csi_res_periodicity_and_offset_c::types_opts::options::slots40: csi_rs_nzp_resource.periodicity.period = 40;
csi_rs_nzp_resource.periodicity.period = 40; csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots40();
csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots40(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots64:
case csi_res_periodicity_and_offset_c::types_opts::options::slots64: csi_rs_nzp_resource.periodicity.period = 64;
csi_rs_nzp_resource.periodicity.period = 64; csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots64();
csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots64(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots80:
case csi_res_periodicity_and_offset_c::types_opts::options::slots80: csi_rs_nzp_resource.periodicity.period = 80;
csi_rs_nzp_resource.periodicity.period = 80; csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots80();
csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots80(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots160:
case csi_res_periodicity_and_offset_c::types_opts::options::slots160: csi_rs_nzp_resource.periodicity.period = 160;
csi_rs_nzp_resource.periodicity.period = 160; csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots160();
csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots160(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots320:
case csi_res_periodicity_and_offset_c::types_opts::options::slots320: csi_rs_nzp_resource.periodicity.period = 320;
csi_rs_nzp_resource.periodicity.period = 320; csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots320();
csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots320(); break;
break; case csi_res_periodicity_and_offset_c::types_opts::options::slots640:
case csi_res_periodicity_and_offset_c::types_opts::options::slots640: csi_rs_nzp_resource.periodicity.period = 640;
csi_rs_nzp_resource.periodicity.period = 640; csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots640();
csi_rs_nzp_resource.periodicity.offset = asn1_nzp_csi_rs_res.periodicity_and_offset.slots640(); break;
break; default:
default: asn1::log_warning("Invalid option for periodicity_and_offset %s",
asn1::log_warning("Invalid option for periodicity_and_offset %s", asn1_nzp_csi_rs_res.periodicity_and_offset.type().to_string());
asn1_nzp_csi_rs_res.periodicity_and_offset.type().to_string()); return false;
return false;
} }
} else { } else {
asn1::log_warning("Option periodicity_and_offset not present"); asn1::log_warning("Option periodicity_and_offset not present");
return false; return false;
} }
csi_rs_nzp_resource.scrambling_id = asn1_nzp_csi_rs_res.scrambling_id; csi_rs_nzp_resource.scrambling_id = asn1_nzp_csi_rs_res.scrambling_id;

Loading…
Cancel
Save