aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-10-25 16:54:47 +0200
committerlaforge <laforge@osmocom.org>2021-10-25 15:57:24 +0000
commit991b4f62838d23a243d35cda4950fea5d218486a (patch)
treecc0e8041b510bcd17c3f6b3a12868e96d00260b8
parent[overpower] scheduler: handle {sacch,facch}_enabled flags (diff)
downloadOsmoBTS-991b4f62838d23a243d35cda4950fea5d218486a.tar.xz
OsmoBTS-991b4f62838d23a243d35cda4950fea5d218486a.zip
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
-rw-r--r--src/osmo-bts-trx/sched_lchan_pdtch.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/osmo-bts-trx/sched_lchan_pdtch.c b/src/osmo-bts-trx/sched_lchan_pdtch.c
index 17523e1f..4c63acb1 100644
--- a/src/osmo-bts-trx/sched_lchan_pdtch.c
+++ b/src/osmo-bts-trx/sched_lchan_pdtch.c
@@ -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;
}