lchan2lch_par(): fix missing default branch in switch

New channel mode values have recently been added with change [1]
to 'enum gsm48_chan_mode'.  The lack of default branch in
lchan2lch_par() caused build failures on Jenkins:

  oml.c:956:2: error: enumeration value ‘GSM48_CMODE_SPEECH_V2_VAMOS’
                      not handled in switch [-Werror=switch]
  oml.c:956:2: error: enumeration value ‘GSM48_CMODE_SPEECH_V3_VAMOS’
                      not handled in switch [-Werror=switch]
  oml.c:956:2: error: enumeration value ‘GSM48_CMODE_SPEECH_V5_VAMOS’
                      not handled in switch [-Werror=switch]

This function is duplicated in osmo-bts-{lc15,oc2g,octphy,sysmo},
so we unfortunately need to apply the same fix to all copy-pasted files.

Change-Id: I557ff8cac6564d22485c101fba9212f5f0e95bb7
Related: [1] Ie0ea592da5610ae70290106d004e549cf3212a89
This commit is contained in:
Vadim Yanitskiy 2021-04-20 22:25:58 +02:00
parent 0436fe7fca
commit 4f346b0458
4 changed files with 63 additions and 25 deletions

View File

@ -935,7 +935,7 @@ static void set_payload_format(GsmL1_LogChParam_t *lch_par)
lch_par->tch.tchPlFmt = GsmL1_TchPlFmt_Rtp;
}
static void lchan2lch_par(GsmL1_LogChParam_t *lch_par, struct gsm_lchan *lchan)
static int lchan2lch_par(GsmL1_LogChParam_t *lch_par, struct gsm_lchan *lchan)
{
struct amr_multirate_conf *amr_mrc = &lchan->tch.amr_mr;
struct gsm48_multi_rate_conf *mr_conf =
@ -1020,10 +1020,13 @@ static void lchan2lch_par(GsmL1_LogChParam_t *lch_par, struct gsm_lchan *lchan)
case GSM48_CMODE_DATA_12k0:
case GSM48_CMODE_DATA_6k0:
case GSM48_CMODE_DATA_3k6:
LOGP(DL1C, LOGL_ERROR, "%s: CSD not supported!\n",
gsm_lchan_name(lchan));
break;
default:
LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "Channel mode %s is not supported!\n",
gsm48_chan_mode_name(lchan->tch_mode));
return -ENOTSUP;
}
return 0;
}
static int mph_send_activate_req(struct gsm_lchan *lchan, struct sapi_cmd *cmd)
@ -1032,6 +1035,7 @@ static int mph_send_activate_req(struct gsm_lchan *lchan, struct sapi_cmd *cmd)
struct msgb *msg = l1p_msgb_alloc();
int sapi = cmd->sapi;
int dir = cmd->dir;
int rc;
GsmL1_MphActivateReq_t *act_req;
GsmL1_LogChParam_t *lch_par;
@ -1054,7 +1058,10 @@ static int mph_send_activate_req(struct gsm_lchan *lchan, struct sapi_cmd *cmd)
break;
case GsmL1_Sapi_TchH:
case GsmL1_Sapi_TchF:
lchan2lch_par(lch_par, lchan);
if ((rc = lchan2lch_par(lch_par, lchan)) != 0) {
talloc_free(msg);
return rc;
}
/*
* Be sure that every packet is received, even if it
* fails. In this case the length might be lower or 0.
@ -1390,6 +1397,7 @@ static int mph_send_config_logchpar(struct gsm_lchan *lchan, struct sapi_cmd *cm
struct msgb *msg = l1p_msgb_alloc();
GsmL1_MphConfigReq_t *conf_req;
GsmL1_LogChParam_t *lch_par;
int rc;
/* channel mode, encryption and/or multirate have changed */
@ -1404,7 +1412,10 @@ static int mph_send_config_logchpar(struct gsm_lchan *lchan, struct sapi_cmd *cm
conf_req->hLayer3 = (HANDLE)l1if_lchan_to_hLayer(lchan);
lch_par = &conf_req->cfgParams.setLogChParams.logChParams;
lchan2lch_par(lch_par, lchan);
if ((rc = lchan2lch_par(lch_par, lchan)) != 0) {
talloc_free(msg);
return rc;
}
/* Update the MS Power Level */
if (cmd->sapi == GsmL1_Sapi_Sacch && trx_ms_pwr_ctrl_is_osmo(trx))

View File

@ -950,7 +950,7 @@ static void set_payload_format(GsmL1_LogChParam_t *lch_par)
lch_par->tch.tchPlFmt = GsmL1_TchPlFmt_Rtp;
}
static void lchan2lch_par(GsmL1_LogChParam_t *lch_par, struct gsm_lchan *lchan)
static int lchan2lch_par(GsmL1_LogChParam_t *lch_par, struct gsm_lchan *lchan)
{
struct amr_multirate_conf *amr_mrc = &lchan->tch.amr_mr;
struct gsm48_multi_rate_conf *mr_conf =
@ -1035,10 +1035,13 @@ static void lchan2lch_par(GsmL1_LogChParam_t *lch_par, struct gsm_lchan *lchan)
case GSM48_CMODE_DATA_12k0:
case GSM48_CMODE_DATA_6k0:
case GSM48_CMODE_DATA_3k6:
LOGP(DL1C, LOGL_ERROR, "%s: CSD not supported!\n",
gsm_lchan_name(lchan));
break;
default:
LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "Channel mode %s is not supported!\n",
gsm48_chan_mode_name(lchan->tch_mode));
return -ENOTSUP;
}
return 0;
}
static int mph_send_activate_req(struct gsm_lchan *lchan, struct sapi_cmd *cmd)
@ -1047,6 +1050,7 @@ static int mph_send_activate_req(struct gsm_lchan *lchan, struct sapi_cmd *cmd)
struct msgb *msg = l1p_msgb_alloc();
int sapi = cmd->sapi;
int dir = cmd->dir;
int rc;
GsmL1_MphActivateReq_t *act_req;
GsmL1_LogChParam_t *lch_par;
@ -1069,7 +1073,10 @@ static int mph_send_activate_req(struct gsm_lchan *lchan, struct sapi_cmd *cmd)
break;
case GsmL1_Sapi_TchH:
case GsmL1_Sapi_TchF:
lchan2lch_par(lch_par, lchan);
if ((rc = lchan2lch_par(lch_par, lchan)) != 0) {
talloc_free(msg);
return rc;
}
/*
* Be sure that every packet is received, even if it
* fails. In this case the length might be lower or 0.
@ -1401,6 +1408,7 @@ static int mph_send_config_logchpar(struct gsm_lchan *lchan, struct sapi_cmd *cm
struct msgb *msg = l1p_msgb_alloc();
GsmL1_MphConfigReq_t *conf_req;
GsmL1_LogChParam_t *lch_par;
int rc;
/* channel mode, encryption and/or multirate have changed */
@ -1415,7 +1423,10 @@ static int mph_send_config_logchpar(struct gsm_lchan *lchan, struct sapi_cmd *cm
conf_req->hLayer3 = (HANDLE)l1if_lchan_to_hLayer(lchan);
lch_par = &conf_req->cfgParams.setLogChParams.logChParams;
lchan2lch_par(lch_par, lchan);
if ((rc = lchan2lch_par(lch_par, lchan)) != 0) {
talloc_free(msg);
return rc;
}
/* Update the MS Power Level */
if (cmd->sapi == GsmL1_Sapi_Sacch && trx_ms_pwr_ctrl_is_osmo(trx))

View File

@ -250,7 +250,7 @@ static void clear_amr_params(tOCTVC1_GSM_LOGICAL_CHANNEL_CONFIG * p_Config)
p_Config->abyRate[i] = cOCTVC1_GSM_AMR_CODEC_MODE_ENUM_UNSET;
}
static void lchan2lch_par(struct gsm_lchan *lchan,
static int lchan2lch_par(struct gsm_lchan *lchan,
tOCTVC1_GSM_LOGICAL_CHANNEL_CONFIG * p_Config)
{
struct amr_multirate_conf *amr_mrc = &lchan->tch.amr_mr;
@ -348,11 +348,13 @@ static void lchan2lch_par(struct gsm_lchan *lchan,
case GSM48_CMODE_DATA_12k0:
case GSM48_CMODE_DATA_6k0:
case GSM48_CMODE_DATA_3k6:
LOGP(DL1C, LOGL_ERROR, "%s: CSD not supported!\n",
gsm_lchan_name(lchan));
break;
default:
LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "Channel mode %s is not supported!\n",
gsm48_chan_mode_name(lchan->tch_mode));
return -ENOTSUP;
}
return 0;
}
/***********************************************************************
@ -444,6 +446,7 @@ static int mph_send_activate_req(struct gsm_lchan *lchan, struct sapi_cmd *cmd)
struct octphy_hdl *fl1h = pinst->phy_link->u.octphy.hdl;
struct msgb *msg = l1p_msgb_alloc();
tOCTVC1_GSM_MSG_TRX_ACTIVATE_LOGICAL_CHANNEL_CMD *lac;
int rc;
lac = (tOCTVC1_GSM_MSG_TRX_ACTIVATE_LOGICAL_CHANNEL_CMD *)
msgb_put(msg, sizeof(*lac));
@ -458,8 +461,10 @@ static int mph_send_activate_req(struct gsm_lchan *lchan, struct sapi_cmd *cmd)
lac->Config.byTimingAdvance = lchan->rqd_ta;
lac->Config.byBSIC = lchan->ts->trx->bts->bsic;
lchan2lch_par(lchan, &lac->Config);
if ((rc = lchan2lch_par(lchan, &lac->Config)) != 0) {
talloc_free(msg);
return rc;
}
mOCTVC1_GSM_MSG_TRX_ACTIVATE_LOGICAL_CHANNEL_CMD_SWAP(lac);

View File

@ -943,7 +943,7 @@ static void set_payload_format(GsmL1_LogChParam_t *lch_par)
#endif /* L1_HAS_RTP_MODE */
}
static void lchan2lch_par(GsmL1_LogChParam_t *lch_par, struct gsm_lchan *lchan)
static int lchan2lch_par(GsmL1_LogChParam_t *lch_par, struct gsm_lchan *lchan)
{
struct amr_multirate_conf *amr_mrc = &lchan->tch.amr_mr;
struct gsm48_multi_rate_conf *mr_conf =
@ -1028,10 +1028,13 @@ static void lchan2lch_par(GsmL1_LogChParam_t *lch_par, struct gsm_lchan *lchan)
case GSM48_CMODE_DATA_12k0:
case GSM48_CMODE_DATA_6k0:
case GSM48_CMODE_DATA_3k6:
LOGP(DL1C, LOGL_ERROR, "%s: CSD not supported!\n",
gsm_lchan_name(lchan));
break;
default:
LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "Channel mode %s is not supported!\n",
gsm48_chan_mode_name(lchan->tch_mode));
return -ENOTSUP;
}
return 0;
}
static int mph_send_activate_req(struct gsm_lchan *lchan, struct sapi_cmd *cmd)
@ -1040,6 +1043,7 @@ static int mph_send_activate_req(struct gsm_lchan *lchan, struct sapi_cmd *cmd)
struct msgb *msg = l1p_msgb_alloc();
int sapi = cmd->sapi;
int dir = cmd->dir;
int rc;
GsmL1_MphActivateReq_t *act_req;
GsmL1_LogChParam_t *lch_par;
@ -1062,7 +1066,10 @@ static int mph_send_activate_req(struct gsm_lchan *lchan, struct sapi_cmd *cmd)
break;
case GsmL1_Sapi_TchH:
case GsmL1_Sapi_TchF:
lchan2lch_par(lch_par, lchan);
if ((rc = lchan2lch_par(lch_par, lchan)) != 0) {
talloc_free(msg);
return rc;
}
/*
* Be sure that every packet is received, even if it
* fails. In this case the length might be lower or 0.
@ -1347,6 +1354,7 @@ static int mph_send_config_logchpar(struct gsm_lchan *lchan, struct sapi_cmd *cm
struct msgb *msg = l1p_msgb_alloc();
GsmL1_MphConfigReq_t *conf_req;
GsmL1_LogChParam_t *lch_par;
int rc;
/* channel mode, encryption and/or multirate have changed */
@ -1361,7 +1369,10 @@ static int mph_send_config_logchpar(struct gsm_lchan *lchan, struct sapi_cmd *cm
conf_req->hLayer3 = l1if_lchan_to_hLayer(lchan);
lch_par = &conf_req->cfgParams.setLogChParams.logChParams;
lchan2lch_par(lch_par, lchan);
if ((rc = lchan2lch_par(lch_par, lchan)) != 0) {
talloc_free(msg);
return rc;
}
/* Update the MS Power Level */
if (cmd->sapi == GsmL1_Sapi_Sacch && trx_ms_pwr_ctrl_is_osmo(trx))