aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2021-04-12 09:11:39 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2021-04-12 09:11:39 +0200
commitaa9aea2ef66437d7b8b7bedff77b2405efe98863 (patch)
tree9d04da966b71b71bc61a692ec887b027a39ff2e6
parenteff06bd92ba6d6c9bd3b508c22f04f6eb40c64ed (diff)
-rw-r--r--include/osmocom/bsc/bts_trx.h6
-rw-r--r--src/osmo-bsc/bts_ipaccess_nanobts.c4
-rw-r--r--src/osmo-bsc/gsm_data.c10
3 files changed, 14 insertions, 6 deletions
diff --git a/include/osmocom/bsc/bts_trx.h b/include/osmocom/bsc/bts_trx.h
index 7dcf6aa11..cbaf25cd4 100644
--- a/include/osmocom/bsc/bts_trx.h
+++ b/include/osmocom/bsc/bts_trx.h
@@ -31,6 +31,12 @@ struct gsm_bts;
* handles CCHAN and TRXMGMT, which is always done on the primary TRX's RSL link. */
#define TRX_PRIMARY(TRX) ((TRX)->vamos.primary_trx ? : (TRX))
+/* Return true if TRX is a plain primary TRX (with or without VAMOS operation). */
+#define TRX_IS_PRIMARY(TRX) ((TRX)->vamos.primary_trx == NULL)
+
+/* Return true if TRX is a VAMOS shadow TRX. */
+#define TRX_IS_SHADOW(TRX) ((TRX)->vamos.primary_trx != NULL)
+
struct gsm_bts_bb_trx {
struct gsm_abis_mo mo;
};
diff --git a/src/osmo-bsc/bts_ipaccess_nanobts.c b/src/osmo-bsc/bts_ipaccess_nanobts.c
index 16fa20121..e59b61a40 100644
--- a/src/osmo-bsc/bts_ipaccess_nanobts.c
+++ b/src/osmo-bsc/bts_ipaccess_nanobts.c
@@ -149,6 +149,10 @@ static int nm_statechg_event(int evt, struct nm_statechg_signal_data *nsd)
if (!is_ipaccess_bts(nsd->bts))
return 0;
+ OSMO_ASSERT(obj);
+ if (!obj)
+ return -1;
+
switch (obj_class) {
case NM_OC_SITE_MANAGER:
bts_sm = obj;
diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c
index 5d077570f..4f5b714e5 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -458,17 +458,15 @@ gsm_objclass2obj(struct gsm_bts *bts, uint8_t obj_class,
obj = trx;
break;
case NM_OC_BASEB_TRANSC:
- if (obj_inst->trx_nr >= bts->num_trx) {
- return NULL;
- }
trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
+ if (!trx)
+ return NULL;
obj = &trx->bb_transc;
break;
case NM_OC_CHANNEL:
- if (obj_inst->trx_nr >= bts->num_trx) {
- return NULL;
- }
trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
+ if (!trx)
+ return NULL;
if (obj_inst->ts_nr >= TRX_NR_TS)
return NULL;
obj = &trx->ts[obj_inst->ts_nr];