bts-trx: sched_lchan_pdtch: Refactor tx_pdtch_fn to get rid of goto tag

With this change the error case is moved at the end of the function,
which is more usual. At the same time, one goto tag can be removed,
simplifying the function.

This is also a preparation for next patch improvinga bit the logic
around same place.

Related: SYS#5676
Related: SYS#4919
Change-Id: Ifbd95ccbebf4d810b1fe0a162722e63fe69106b8
This commit is contained in:
Pau Espin 2021-10-25 16:54:47 +02:00 committed by laforge
parent 2e8332d650
commit 991b4f6283
1 changed files with 11 additions and 12 deletions

View File

@ -161,20 +161,11 @@ int tx_pdtch_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
/* get mac block from queue */
msg = _sched_dequeue_prim(l1ts, br);
if (msg)
goto got_msg;
LOGL1SB(DL1P, LOGL_INFO, l1ts, br, "No prim for transmit.\n");
no_msg:
/* free burst memory */
if (*bursts_p) {
talloc_free(*bursts_p);
*bursts_p = NULL;
if (!msg) {
LOGL1SB(DL1P, LOGL_INFO, l1ts, br, "No prim for transmit.\n");
goto no_msg;
}
return -ENODEV;
got_msg:
/* BURST BYPASS */
/* allocate burst memory, if not already */
@ -229,4 +220,12 @@ send_burst:
LOGL1SB(DL1P, LOGL_DEBUG, l1ts, br, "Transmitting burst=%u.\n", br->bid);
return 0;
no_msg:
/* free burst memory */
if (*bursts_p) {
talloc_free(*bursts_p);
*bursts_p = NULL;
}
return -ENODEV;
}