-
Notifications
You must be signed in to change notification settings - Fork 227
Description
Is your feature request related to a problem? Please describe.
Multiple returns and an (invalid) possible uninitialized variable warning shows up from static analysis:
cFE/fsw/cfe-core/src/time/cfe_time_api.c
Lines 758 to 786 in 56397a3
| int32 CFE_TIME_RegisterSynchCallback(CFE_TIME_SynchCallbackPtr_t CallbackFuncPtr) | |
| { | |
| int32 Status; | |
| CFE_ES_ResourceID_t AppId; | |
| uint32 AppIndex; | |
| Status = CFE_ES_GetAppID(&AppId); | |
| if (Status == CFE_SUCCESS) | |
| { | |
| Status = CFE_ES_AppID_ToIndex(AppId, &AppIndex); | |
| } | |
| if (Status != CFE_SUCCESS) | |
| { | |
| /* Called from an invalid context */ | |
| return Status; | |
| } | |
| if (AppIndex >= (sizeof(CFE_TIME_TaskData.SynchCallback) / sizeof(CFE_TIME_TaskData.SynchCallback[0])) || | |
| CFE_TIME_TaskData.SynchCallback[AppIndex].Ptr != NULL) | |
| { | |
| Status = CFE_TIME_TOO_MANY_SYNCH_CALLBACKS; | |
| } | |
| else | |
| { | |
| CFE_TIME_TaskData.SynchCallback[AppIndex].Ptr = CallbackFuncPtr; | |
| } | |
| return Status; | |
| } /* End of CFE_TIME_RegisterSynchCallback() */ |
Describe the solution you'd like
Refactor for one return and avoid warning.
Describe alternatives you've considered
Leave as is (works)
Additional context
None
Requester Info
Jacob Hageman - NASA/GSFC