aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/bsc/lchan_fsm.h3
-rw-r--r--src/osmo-bsc/bsc_vty.c7
2 files changed, 5 insertions, 5 deletions
diff --git a/include/osmocom/bsc/lchan_fsm.h b/include/osmocom/bsc/lchan_fsm.h
index a69890bb2..e5b093340 100644
--- a/include/osmocom/bsc/lchan_fsm.h
+++ b/include/osmocom/bsc/lchan_fsm.h
@@ -81,7 +81,8 @@ static inline const char *lchan_state_name(struct gsm_lchan *lchan)
static inline bool lchan_state_is(struct gsm_lchan *lchan, uint32_t state)
{
- return lchan->fi && lchan->fi->state == state;
+ return (!lchan->fi && state == LCHAN_ST_UNUSED)
+ || (lchan->fi && lchan->fi->state == state);
}
bool lchan_may_receive_data(struct gsm_lchan *lchan);
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index e068db6c6..32b139f4d 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -1345,10 +1345,9 @@ static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
static int dump_lchan_trx_ts(struct gsm_bts_trx_ts *ts, struct vty *vty,
void (*dump_cb)(struct vty *, struct gsm_lchan *))
{
- int lchan_nr;
- for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN; lchan_nr++) {
- struct gsm_lchan *lchan = &ts->lchan[lchan_nr];
- if ((lchan->type == GSM_LCHAN_NONE) && lchan_state_is(lchan, LCHAN_ST_UNUSED))
+ struct gsm_lchan *lchan;
+ ts_for_each_lchan(lchan, ts) {
+ if (lchan_state_is(lchan, LCHAN_ST_UNUSED))
continue;
dump_cb(vty, lchan);
}