openwrt/package/kernel/lantiq/ltq-tapi/patches/600-fix-compilation-warning-switch-fallthrough.patch
Christian Marangi 3978795e54
kernel: ltq-tapi: add patch fixing compilation warning
Add patch fixing compilation warning for switch fallthrough and
copy_to_user ret not handled.
Fix compilation warning:
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_dial.c: In function 'ifx_tapi_dial_OnTimer':
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_dial.c:318:38: error: this statement may fall through [-Werror=implicit-fallthrough=]
  318 |          pTapiDialData->nHookChanges = 0;
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_dial.c:322:7: note: here
  322 |       case TAPI_HOOK_STATE_DIAL_L_VAL:
      |       ^~~~
cc1: all warnings being treated as errors

/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_event.c: In function 'IFX_TAPI_Event_Dispatch_ProcessCtx':
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_event.c:1546:30: error: this statement may fall through [-Werror=implicit-fallthrough=]
 1546 |                   pEvent->ch = IFX_TAPI_DEVICE_CH_NUMBER;
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_event.c:1548:16: note: here
 1548 |                case  IFX_TAPI_ERRSRC_LL_CH:
      |                ^~~~
cc1: all warnings being treated as errors

/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_ioctl.c: In function 'TAPI_IoctlDev':
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_ioctl.c:705:19: error: ignoring return value of 'copy_to_user' declared with attribute 'warn_unused_result' [-Werror=unused-result]
  705 |                   copy_to_user ((IFX_void_t*)ioarg, p_tmp, sizeof(IFX_TAPI_CAP_t));
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_ioctl.c: In function 'TAPI_IoctlCh':
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_ioctl.c:1553:14: error: this statement may fall through [-Werror=implicit-fallthrough=]
 1553 |          ret = TAPI_statusNotSupported;
      |          ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_ioctl.c:1555:7: note: here
 1555 |       default:
      |       ^~~~~~~
cc1: all warnings being treated as errors

/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c: In function 'cid_fsm_alert_exec':
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:2037:31: error: this statement may fall through [-Werror=implicit-fallthrough=]
 2037 |          pTxData->nCidSubState++;
      |          ~~~~~~~~~~~~~~~~~~~~~^~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:2039:7: note: here
 2039 |       case 1:
      |       ^~~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:2053:31: error: this statement may fall through [-Werror=implicit-fallthrough=]
 2053 |          pTxData->nCidSubState++;
      |          ~~~~~~~~~~~~~~~~~~~~~^~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:2055:7: note: here
 2055 |       case 2:
      |       ^~~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:2070:31: error: this statement may fall through [-Werror=implicit-fallthrough=]
 2070 |          pTxData->nCidSubState++;
      |          ~~~~~~~~~~~~~~~~~~~~~^~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:2072:7: note: here
 2072 |       default:
      |       ^~~~~~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c: In function 'cid_prepare_data':
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:1501:13: error: this statement may fall through [-Werror=implicit-fallthrough=]
 1501 |          if (IFX_TAPI_CID_HM_ONHOOK == pTxData->txHookMode)
      |             ^
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:1509:7: note: here
 1509 |       default:
      |       ^~~~~~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:1531:16: error: this statement may fall through [-Werror=implicit-fallthrough=]
 1531 |             if (IFX_TAPI_CID_STD_KPN_DTMF_FSK != pConfData->nStandard)
      |                ^
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:1535:10: note: here
 1535 |          case IFX_TAPI_CID_GEN_TYPE_FSK:
      |          ^~~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c: In function 'cid_lookup_transparent':
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:1425:10: error: this statement may fall through [-Werror=implicit-fallthrough=]
 1425 |          cidfsk_set_tx_time (pTxData, &pConfData->TapiCidFskConf);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:1427:7: note: here
 1427 |       case IFX_TAPI_CID_GEN_TYPE_DTMF:
      |       ^~~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c: In function 'TAPI_Phone_CID_Stop_Tx':
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:3445:10: error: this statement may fall through [-Werror=implicit-fallthrough=]
 3445 |          switch (pTxData->nAlertType)
      |          ^~~~~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:3461:7: note: here
 3461 |       case TAPI_CID_STATE_ACK:
      |       ^~~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:3463:13: error: this statement may fall through [-Werror=implicit-fallthrough=]
 3463 |          if (ptr_chk(pDrvCtx->SIG.DTMFD_Override, ""))
      |             ^
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:3472:7: note: here
 3472 |       case TAPI_CID_STATE_SENDING:
      |       ^~~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c: In function 'TAPI_Phone_Get_CidRxData':
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:4060:10: error: this statement may fall through [-Werror=implicit-fallthrough=]
 4060 |       if (IFX_Fifo_isEmpty(&(pCidRx->TapiCidRxFifo)))
      |          ^
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_tapi-3.13.0/src/drv_tapi_cid.c:4069:4: note: here
 4069 |    default:
      |    ^~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-05-12 03:15:46 +02:00

115 lines
4.4 KiB
Diff

--- a/src/drv_tapi_cid.c
+++ b/src/drv_tapi_cid.c
@@ -1424,6 +1424,8 @@ static IFX_int32_t cid_lookup_transparent(TAPI_CIDTX_DATA_t *pTxData,
cidfsk_set_tx_time (pTxData, &pConfData->TapiCidFskConf);
+ fallthrough;
+
case IFX_TAPI_CID_GEN_TYPE_DTMF:
memcpy (pTxData->cidBuf[IFX_TAPI_CID_GEN_TYPE_DTMF].pBuf,
pMessage[0].transparent.data, pMessage[0].transparent.len);
@@ -1497,6 +1499,7 @@ static IFX_int32_t cid_prepare_data(TAPI_CHANNEL *pChannel,
break;
case IFX_TAPI_CID_STD_KPN_DTMF:
/*lint -fallthrough*/
+ fallthrough;
case IFX_TAPI_CID_STD_KPN_DTMF_FSK:
if (IFX_TAPI_CID_HM_ONHOOK == pTxData->txHookMode)
{
@@ -1506,6 +1509,7 @@ static IFX_int32_t cid_prepare_data(TAPI_CHANNEL *pChannel,
}
/* KPN CID Type 2 (off-hook) always using FSK */
/*lint -fallthrough*/
+ fallthrough;
default:
pTxData->cidGenType = IFX_TAPI_CID_GEN_TYPE_FSK;
break;
@@ -1532,6 +1536,7 @@ static IFX_int32_t cid_prepare_data(TAPI_CHANNEL *pChannel,
break;
/*lint -fallthrough*/
+ fallthrough;
case IFX_TAPI_CID_GEN_TYPE_FSK:
if (IFX_TAPI_CID_STD_NTT == pConfData->nStandard)
@@ -2036,6 +2041,7 @@ static FSM_STATUS_t cid_fsm_alert_exec(TAPI_CHANNEL *pChannel)
}
pTxData->nCidSubState++;
/*lint -fallthrough*/
+ fallthrough;
case 1:
if (pConfData->OSIoffhook && pConfData->nSAStone)
{
@@ -2052,6 +2058,7 @@ static FSM_STATUS_t cid_fsm_alert_exec(TAPI_CHANNEL *pChannel)
}
pTxData->nCidSubState++;
/*lint -fallthrough*/
+ fallthrough;
case 2:
if (pConfData->nSAStone)
{
@@ -2069,6 +2076,7 @@ static FSM_STATUS_t cid_fsm_alert_exec(TAPI_CHANNEL *pChannel)
}
pTxData->nCidSubState++;
/*lint -fallthrough*/
+ fallthrough;
default:
/* Play CAS tone on data channel, use unprotected function, protection
is done around cid_fsm_alert_exec */
@@ -3458,6 +3466,7 @@ IFX_int32_t TAPI_Phone_CID_Stop_Tx(TAPI_CHANNEL *pChannel)
}
/* deliberately fall through */
/*lint -fallthrough*/
+ fallthrough;
case TAPI_CID_STATE_ACK:
/* deactivate the DTMF override - last two params are ignored */
if (ptr_chk(pDrvCtx->SIG.DTMFD_Override, ""))
@@ -3469,6 +3478,7 @@ IFX_int32_t TAPI_Phone_CID_Stop_Tx(TAPI_CHANNEL *pChannel)
}
/* deliberately fall through */
/*lint -fallthrough*/
+ fallthrough;
case TAPI_CID_STATE_SENDING:
TAPI_Stop_Timer (pTxData->CidTimerID);
break;
@@ -4066,6 +4076,7 @@ IFX_int32_t TAPI_Phone_Get_CidRxData (TAPI_CHANNEL *pChannel,
/* If the fifo is not empty take the data from the fifo first. */
/* deliberately fallthrough to default case */
/*lint -fallthrough*/
+ fallthrough;
default:
/* Allow readout of data in all other states not handled above.
When there is no data in the fifo TAPI_statusErr is returned. */
--- a/src/drv_tapi_dial.c
+++ b/src/drv_tapi_dial.c
@@ -319,6 +319,8 @@ static IFX_void_t ifx_tapi_dial_OnTimer(Timer_ID Timer, IFX_ulong_t nArg)
/* NOTE: the "break" statement has been intentionally omitted */
/*lint -fallthrough */
+ fallthrough;
+
case TAPI_HOOK_STATE_DIAL_L_VAL:
/* digit_l_min expires: onhook has lasted long enough to be a
certain low pulse (not noise). The next state is the overlap with
--- a/src/drv_tapi_event.c
+++ b/src/drv_tapi_event.c
@@ -1545,6 +1545,7 @@ IFX_int32_t IFX_TAPI_Event_Dispatch_ProcessCtx(IFX_TAPI_EXT_EVENT_PARAM_t*
/**\todo put in device fifo */
pEvent->ch = IFX_TAPI_DEVICE_CH_NUMBER;
/*lint -fallthrough */
+ fallthrough;
case IFX_TAPI_ERRSRC_LL_CH:
pEvent->data.value |= IFX_TAPI_ERRSRC_LL;
break;
--- a/src/drv_tapi_ioctl.c
+++ b/src/drv_tapi_ioctl.c
@@ -1552,6 +1553,7 @@ static IFX_int32_t TAPI_IoctlCh (IFX_TAPI_DRV_CTX_t* pDrvCtx,
/* Dial Services */
ret = TAPI_statusNotSupported;
/*lint -fallthrough*/
+ fallthrough;
default:
bHandled = IFX_FALSE;
break;