fix handling of odd pchans in bts_supports_cm()
Convert the if-cascade to a switch(). For any unexpected pchan kind, reject the chan mode immediately instead of going on to invoke gsm_bts_has_feature on feature = _NUM_BTS_FEAT, and log the error. Tweaked-by: neels Change-Id: Ieaded9258554b15fcc4b7f05d5a8847175b7962f
This commit is contained in:
parent
734eb40e72
commit
17577b7c00
|
@ -704,7 +704,8 @@ int bts_supports_cm(struct gsm_bts *bts, enum gsm_phys_chan_config pchan,
|
|||
|
||||
/* Before the requested pchan/cm combination can be checked, we need to
|
||||
* convert it to a feature identifier we can check */
|
||||
if (pchan == GSM_PCHAN_TCH_F) {
|
||||
switch (pchan) {
|
||||
case GSM_PCHAN_TCH_F:
|
||||
switch(cm) {
|
||||
case GSM48_CMODE_SPEECH_V1:
|
||||
feature = BTS_FEAT_SPEECH_F_V1;
|
||||
|
@ -719,7 +720,9 @@ int bts_supports_cm(struct gsm_bts *bts, enum gsm_phys_chan_config pchan,
|
|||
/* Invalid speech codec type => Not supported! */
|
||||
return 0;
|
||||
}
|
||||
} else if (pchan == GSM_PCHAN_TCH_H) {
|
||||
break;
|
||||
|
||||
case GSM_PCHAN_TCH_H:
|
||||
switch(cm) {
|
||||
case GSM48_CMODE_SPEECH_V1:
|
||||
feature = BTS_FEAT_SPEECH_H_V1;
|
||||
|
@ -731,6 +734,12 @@ int bts_supports_cm(struct gsm_bts *bts, enum gsm_phys_chan_config pchan,
|
|||
/* Invalid speech codec type => Not supported! */
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
LOGP(DRSL, LOGL_ERROR, "BTS %u: unhandled pchan %s when checking mode %s\n",
|
||||
bts->nr, gsm_pchan_name(pchan), gsm48_chan_mode_name(cm));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check if the feature is supported by this BTS */
|
||||
|
|
Loading…
Reference in New Issue