From 28224deee110599e231e12b737a42a20a3f0b16f Mon Sep 17 00:00:00 2001 From: Avi Date: Mon, 20 Mar 2023 09:19:54 +1000 Subject: [PATCH] Fix #69, Simplify CS_AttemptTableReshare --- fsw/src/cs_utils.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/fsw/src/cs_utils.c b/fsw/src/cs_utils.c index f4645fe..196fc57 100644 --- a/fsw/src/cs_utils.c +++ b/fsw/src/cs_utils.c @@ -1004,36 +1004,28 @@ int32 CS_HandleRoutineTableUpdates(void) int32 CS_AttemptTableReshare(CS_Res_Tables_Table_Entry_t *ResultsEntry, CFE_TBL_Handle_t *LocalTblHandle, CFE_TBL_Info_t *TblInfo, cpuaddr *LocalAddress, int32 *ResultGetInfo) { - int32 Result = CS_SUCCESS; - int32 ResultShare = 0; - int32 ResultGetAddress = 0; + int32 Result; /* Maybe the table came back, try and reshare it */ - ResultShare = CFE_TBL_Share(LocalTblHandle, ResultsEntry->Name); + Result = CFE_TBL_Share(LocalTblHandle, ResultsEntry->Name); - if (ResultShare == CFE_SUCCESS) + if (Result == CFE_SUCCESS) { ResultsEntry->TblHandle = *LocalTblHandle; *ResultGetInfo = CFE_TBL_GetInfo(TblInfo, ResultsEntry->Name); /* need to try to get the address again */ - ResultGetAddress = CFE_TBL_GetAddress((void *)LocalAddress, *LocalTblHandle); - Result = ResultGetAddress; + Result = CFE_TBL_GetAddress((void *)LocalAddress, *LocalTblHandle); /* if the table was never loaded, release the address to prevent the table from being locked by CS, which would prevent the owner app from updating it*/ - if (ResultGetAddress == CFE_TBL_ERR_NEVER_LOADED) + if (Result == CFE_TBL_ERR_NEVER_LOADED) { CFE_TBL_ReleaseAddress(*LocalTblHandle); } } - else /* table was not there on the new share */ - { - Result = ResultShare; - } - return Result; }