summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-08-16 14:05:24 +0600
committerVadim Yanitskiy <axilirator@gmail.com>2017-10-23 22:05:49 +0330
commit9c310fd803865f38396daabc0582856910b721d9 (patch)
tree002e398254a55c2a5e4bd38821f9d2c7f64a8463
parentda83ccf9f7013289ca37931cf1ec3a8b6aaf4753 (diff)
host/trxcon/scheduler: fix prim queue flushing function
For some reasons, the function, which is used to flush a queue of transmit primitives, was intended to flush a list of msgb instances instead of trx_ts_prim, so memory was being cleaned incorrectly. Moreover, the items weren't actually removed from queue. Change-Id: Ia84b57350a5c2eee0afebc65f62e30eaddb141d4
-rw-r--r--src/host/trxcon/sched_trx.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c
index 7f6729c..c7520b9 100644
--- a/src/host/trxcon/sched_trx.c
+++ b/src/host/trxcon/sched_trx.c
@@ -37,12 +37,14 @@
#include "trx_if.h"
#include "logging.h"
-static void msgb_queue_flush(struct llist_head *list)
+static void prim_queue_flush(struct llist_head *list)
{
- struct msgb *msg, *msg2;
+ struct trx_ts_prim *prim, *prim_next;
- llist_for_each_entry_safe(msg, msg2, list, list)
- msgb_free(msg);
+ llist_for_each_entry_safe(prim, prim_next, list, list) {
+ llist_del(&prim->list);
+ talloc_free(prim);
+ }
}
static void sched_frame_clck_cb(struct trx_sched *sched)
@@ -191,7 +193,7 @@ void sched_trx_del_ts(struct trx_instance *trx, int tn)
LOGP(DSCH, LOGL_NOTICE, "Delete TDMA timeslot #%u\n", tn);
/* Flush queue primitives for TX */
- msgb_queue_flush(&ts->tx_prims);
+ prim_queue_flush(&ts->tx_prims);
/* Remove ts from list and free memory */
trx->ts_list[tn] = NULL;
@@ -278,7 +280,7 @@ int sched_trx_reset_ts(struct trx_instance *trx, int tn)
ts->mf_layout = NULL;
/* Flush queue primitives for TX */
- msgb_queue_flush(&ts->tx_prims);
+ prim_queue_flush(&ts->tx_prims);
/* Free channel states */
talloc_free(ts->lchans);