libmsc/ran_msg_a.c: refactor ran_a_decode_lcls_notification()

We basically need to make sure that one of two possible IEs
is not NULL, while another is NULL (eXclusive OR). This can
be done using at least two conditional branches.

Change-Id: Ie0f9b5c1bbbfb744e0615da07d76037d91b0abc8
Fixes: CID#198444 Logically dead code
This commit is contained in:
Vadim Yanitskiy 2019-05-11 04:22:55 +07:00 committed by Harald Welte
parent bfe8eb7620
commit 18e8b39fcd
1 changed files with 3 additions and 10 deletions

View File

@ -375,13 +375,7 @@ static int ran_a_decode_lcls_notification(struct ran_dec *ran_dec, const struct
struct ran_msg ran_dec_msg;
/* Either §3.2.2.119 LCLS-BSS-Status or §3.2.2.120 LCLS-Break-Request shall be present */
if ((!ie_lcls_bss_status && !ie_lcls_break_req)
|| (ie_lcls_bss_status && ie_lcls_break_req)) {
LOG_RAN_A_DEC(ran_dec, LOGL_ERROR, "Ignoring broken LCLS Notification message\n");
return -EINVAL;
}
if (ie_lcls_bss_status) {
if (ie_lcls_bss_status && !ie_lcls_break_req) {
ran_dec_msg = (struct ran_msg){
.msg_type = RAN_MSG_LCLS_STATUS,
.msg_name = "BSSMAP LCLS Notification (LCLS Status)",
@ -391,9 +385,7 @@ static int ran_a_decode_lcls_notification(struct ran_dec *ran_dec, const struct
},
};
return ran_decoded(ran_dec, &ran_dec_msg);
}
if (ie_lcls_break_req) {
} else if (ie_lcls_break_req && !ie_lcls_bss_status) {
ran_dec_msg = (struct ran_msg){
.msg_type = RAN_MSG_LCLS_BREAK_REQ,
.msg_name = "BSSMAP LCLS Notification (LCLS Break Req)",
@ -404,6 +396,7 @@ static int ran_a_decode_lcls_notification(struct ran_dec *ran_dec, const struct
return ran_decoded(ran_dec, &ran_dec_msg);
}
LOG_RAN_A_DEC(ran_dec, LOGL_ERROR, "Ignoring broken LCLS Notification message\n");
return -EINVAL;
}