summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libbsc/chan_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsc/src/libbsc/chan_alloc.c')
-rw-r--r--openbsc/src/libbsc/chan_alloc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c
index de9da810d..c9c5fa8c8 100644
--- a/openbsc/src/libbsc/chan_alloc.c
+++ b/openbsc/src/libbsc/chan_alloc.c
@@ -161,12 +161,14 @@ struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type,
if (allow_bigger) {
if (lchan == NULL) {
lchan = _lc_find_bts(bts, GSM_PCHAN_TCH_H);
- type = GSM_LCHAN_TCH_H;
+ if (lchan)
+ type = GSM_LCHAN_TCH_H;
}
if (lchan == NULL) {
lchan = _lc_find_bts(bts, GSM_PCHAN_TCH_F);
- type = GSM_LCHAN_TCH_F;
+ if (lchan)
+ type = GSM_LCHAN_TCH_F;
}
}
break;
@@ -175,7 +177,8 @@ struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type,
/* If we don't have TCH/F available, fall-back to TCH/H */
if (!lchan) {
lchan = _lc_find_bts(bts, GSM_PCHAN_TCH_H);
- type = GSM_LCHAN_TCH_H;
+ if (lchan)
+ type = GSM_LCHAN_TCH_H;
}
break;
case GSM_LCHAN_TCH_H:
@@ -183,7 +186,8 @@ struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type,
/* If we don't have TCH/H available, fall-back to TCH/F */
if (!lchan) {
lchan = _lc_find_bts(bts, GSM_PCHAN_TCH_F);
- type = GSM_LCHAN_TCH_F;
+ if (lchan)
+ type = GSM_LCHAN_TCH_F;
}
break;
default: