From 5c17eea8d2e832648c06bfc8f562b3508ad187be Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Fri, 23 Oct 2026 08:19:13 -0400 Subject: [PATCH] Fix nasa#532, Remove assignments that are never used --- fsw/src/cf_cfdp.c | 3 +-- fsw/src/cf_cfdp_r.c | 8 ++++---- fsw/src/cf_cfdp_s.c | 8 ++++---- fsw/src/cf_cmd.c | 3 +-- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/fsw/src/cf_cfdp.c b/fsw/src/cf_cfdp.c index bb56fa41..110b126a 100644 --- a/fsw/src/cf_cfdp.c +++ b/fsw/src/cf_cfdp.c @@ -213,7 +213,6 @@ bool CF_CFDP_CheckAckNakCount(CF_Transaction_t *txn, uint8 *counter) uint16 Event; /* Check limit and handle if needed */ - Event = 0; is_ok = (*counter < chan->config.ack_limit); if (is_ok) @@ -1259,7 +1258,7 @@ static int32 CF_CFDP_DoEngineChannelInit(CF_Engine_t *engine_ptr, CF_Channel_t * int k; const int chan_idx = CF_ChannelSelect_AsIndex(CF_GetChannelFromPtr(chan)); char nbuf[64]; - CFE_Status_t ret = CFE_SUCCESS; + CFE_Status_t ret; /* selectively wipe data within the channel struct - * note this struct also contains the config which is already diff --git a/fsw/src/cf_cfdp_r.c b/fsw/src/cf_cfdp_r.c index ab21ef82..7b63a4d1 100644 --- a/fsw/src/cf_cfdp_r.c +++ b/fsw/src/cf_cfdp_r.c @@ -185,7 +185,7 @@ CFE_Status_t CF_CFDP_R_ProcessFd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t * *-----------------------------------------------------------------*/ void CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - CFE_Status_t ret = CFE_SUCCESS; + CFE_Status_t ret; const CF_Logical_PduEof_t *eof; CF_Channel_t *chan = CF_GetChannelFromTxn(txn); @@ -947,7 +947,7 @@ CF_RxSubState_t CF_CFDP_R_CheckState_VALIDATE(CF_Transaction_t *txn) *-----------------------------------------------------------------*/ CF_RxSubState_t CF_CFDP_R_CheckState_FILESTORE(CF_Transaction_t *txn) { - CF_RxSubState_t next_state = txn->state_data.sub_state; + CF_RxSubState_t next_state; /* This applies the retention policy based on whether the transaction was successful */ /* It sets flags in the txn state if it fails (which will then be sent in the FIN) */ @@ -1010,8 +1010,8 @@ CF_RxSubState_t CF_CFDP_R_CheckState_FINACK(CF_Transaction_t *txn) *-----------------------------------------------------------------*/ void CF_CFDP_R_CheckState(CF_Transaction_t *txn) { - CF_RxSubState_t next_state = txn->state_data.sub_state; - CF_Channel_t *chan = CF_GetChannelFromTxn(txn); + CF_RxSubState_t next_state; + CF_Channel_t *chan = CF_GetChannelFromTxn(txn); /* State transitions are done here */ switch (txn->state_data.sub_state) diff --git a/fsw/src/cf_cfdp_s.c b/fsw/src/cf_cfdp_s.c index b45b5ead..519e3c78 100644 --- a/fsw/src/cf_cfdp_s.c +++ b/fsw/src/cf_cfdp_s.c @@ -48,7 +48,7 @@ *-----------------------------------------------------------------*/ CFE_Status_t CF_CFDP_S_SendFileData(CF_Transaction_t *txn, uint32 foffs, uint32 bytes_to_read, uint8 calc_crc) { - int32 status = 0; + int32 status; CFE_Status_t ret; CF_Engine_t *engine_ptr = CF_GetEngine(); CF_Logical_PduBuffer_t *ph = CF_CFDP_ConstructPduHeader(txn, @@ -808,7 +808,7 @@ CF_TxSubState_t CF_CFDP_S_CheckState_DATA_EOF(CF_Transaction_t *txn) *-----------------------------------------------------------------*/ CF_TxSubState_t CF_CFDP_S_CheckState_FILESTORE(CF_Transaction_t *txn) { - CF_TxSubState_t next_state = txn->state_data.sub_state; + CF_TxSubState_t next_state; /* This applies the retention policy based on whether the transaction was successful */ /* It uses data received in the FIN */ @@ -826,8 +826,8 @@ CF_TxSubState_t CF_CFDP_S_CheckState_FILESTORE(CF_Transaction_t *txn) *-----------------------------------------------------------------*/ void CF_CFDP_S_CheckState(CF_Transaction_t *txn) { - CF_TxSubState_t next_state = txn->state_data.sub_state; - CF_Channel_t *chan = CF_GetChannelFromTxn(txn); + CF_TxSubState_t next_state; + CF_Channel_t *chan = CF_GetChannelFromTxn(txn); /* State transitions are done here */ switch (txn->state_data.sub_state) diff --git a/fsw/src/cf_cmd.c b/fsw/src/cf_cmd.c index 449240dd..dd5d33d3 100644 --- a/fsw/src/cf_cmd.c +++ b/fsw/src/cf_cmd.c @@ -1719,8 +1719,7 @@ static CFE_Status_t CF_GetSet_DoParam(CF_GetSetParam_Context_t *ctxt, uint16 event_id; char msg_buffer[32]; - saved_value = 0; - chan_num = CF_GetChannelFromPtr(chan); + chan_num = CF_GetChannelFromPtr(chan); switch (param_sz) {