From 724dfff9f87da7d8e6b7440b603cd2f1768fb8be Mon Sep 17 00:00:00 2001 From: anh Date: Thu, 12 Dec 2019 08:16:59 -0500 Subject: [PATCH] issue #117, resolve cppcheck --- fsw/mcp750-vxworks/src/cfe_psp_exception.c | 2 +- .../cfe_psp_eeprom_mmap_file.c | 2 +- fsw/pc-linux/src/cfe_psp_memory.c | 38 ++++++++++++++----- fsw/pc-linux/src/cfe_psp_start.c | 8 +++- fsw/pc-rtems/src/cfe_psp_exception.c | 18 +-------- fsw/shared/cfe_psp_module.c | 4 +- 6 files changed, 39 insertions(+), 33 deletions(-) diff --git a/fsw/mcp750-vxworks/src/cfe_psp_exception.c b/fsw/mcp750-vxworks/src/cfe_psp_exception.c index 628e2d15..8326a0e1 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_exception.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_exception.c @@ -87,7 +87,7 @@ char CFE_PSP_ExceptionReasonString[256]; ** */ -void CFE_PSP_ExceptionHook ( TASK_ID task_id, int vector, void* pEsf ); +void CFE_PSP_ExceptionHook ( TASK_ID task_id, int vector, void* vpEsf ); /*************************************************************************** diff --git a/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c b/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c index befa2405..fff9214e 100644 --- a/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c +++ b/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c @@ -190,7 +190,7 @@ void eeprom_mmap_file_Init(uint32 PspModuleId) */ Status = CFE_PSP_MemRangeSet (1, CFE_PSP_MEM_EEPROM, eeprom_address, eeprom_size, CFE_PSP_MEM_SIZE_DWORD, 0 ); - OS_printf("CFE_PSP: EEPROM Range (2) created: Start Address = %08lX, Size = %08X\n", (unsigned long)eeprom_address, (unsigned int)eeprom_size); + OS_printf("CFE_PSP: EEPROM Range (2) created: Start Address = %08lX, Size = %08X Status = %d\n", (unsigned long)eeprom_address, (unsigned int)eeprom_size, Status); } else diff --git a/fsw/pc-linux/src/cfe_psp_memory.c b/fsw/pc-linux/src/cfe_psp_memory.c index a4e99590..17d2457d 100644 --- a/fsw/pc-linux/src/cfe_psp_memory.c +++ b/fsw/pc-linux/src/cfe_psp_memory.c @@ -674,19 +674,37 @@ int32 CFE_PSP_InitProcessorReservedMemory( uint32 RestartType ) tempFd = open(CFE_PSP_RESERVED_KEY_FILE, O_RDONLY | O_CREAT, S_IRWXU ); close(tempFd); - if ( RestartType == CFE_PSP_RST_TYPE_PROCESSOR ) + + return_code = CFE_PSP_InitCDS( RestartType ); + if (return_code != CFE_PSP_SUCCESS) + { + OS_printf("CFE_PSP_InitCDS didn't return success (%d)\n", return_code); + + return(return_code); + } + + return_code = CFE_PSP_InitResetArea( RestartType ); + if (return_code != CFE_PSP_SUCCESS) + { + OS_printf("CFE_PSP_InitResetArea didn't return success (%d)\n", return_code); + + return(return_code); + } + + return_code = CFE_PSP_InitVolatileDiskMem( RestartType ); + if (return_code != CFE_PSP_SUCCESS) { - return_code = CFE_PSP_InitCDS( CFE_PSP_RST_TYPE_PROCESSOR ); - return_code = CFE_PSP_InitResetArea( CFE_PSP_RST_TYPE_PROCESSOR ); - return_code = CFE_PSP_InitVolatileDiskMem( CFE_PSP_RST_TYPE_PROCESSOR ); - return_code = CFE_PSP_InitUserReservedArea( CFE_PSP_RST_TYPE_PROCESSOR ); + OS_printf("CFE_PSP_InitVolatileDiskMem didn't return success (%d)\n", return_code); + + return(return_code); } - else + + return_code = CFE_PSP_InitUserReservedArea( RestartType ); + if (return_code != CFE_PSP_SUCCESS) { - return_code = CFE_PSP_InitCDS( CFE_PSP_RST_TYPE_POWERON ); - return_code = CFE_PSP_InitResetArea( CFE_PSP_RST_TYPE_POWERON ); - return_code = CFE_PSP_InitVolatileDiskMem( CFE_PSP_RST_TYPE_POWERON ); - return_code = CFE_PSP_InitUserReservedArea( CFE_PSP_RST_TYPE_POWERON ); + OS_printf("CFE_PSP_InitVolatileDiskMem didn't return success (%d)\n", return_code); + + return(return_code); } return(return_code); diff --git a/fsw/pc-linux/src/cfe_psp_start.c b/fsw/pc-linux/src/cfe_psp_start.c index 6cc683ad..36de2903 100644 --- a/fsw/pc-linux/src/cfe_psp_start.c +++ b/fsw/pc-linux/src/cfe_psp_start.c @@ -335,8 +335,12 @@ int main(int argc, char *argv[]) /* ** Initialize the reserved memory */ - CFE_PSP_InitProcessorReservedMemory(reset_type); - + Status = CFE_PSP_InitProcessorReservedMemory(reset_type); + if (Status != CFE_PSP_SUCCESS) + { + OS_printf("CFE_PSP: CFE_PSP_InitProcessorReservedMemory() Failure"); + CFE_PSP_Panic(Status); + } /* ** Call cFE entry point. diff --git a/fsw/pc-rtems/src/cfe_psp_exception.c b/fsw/pc-rtems/src/cfe_psp_exception.c index f44f61ba..356b1cf3 100644 --- a/fsw/pc-rtems/src/cfe_psp_exception.c +++ b/fsw/pc-rtems/src/cfe_psp_exception.c @@ -130,23 +130,7 @@ void CFE_PSP_AttachExceptions(void) void CFE_PSP_ExceptionHook (int task_id, int vector, int32 *pEsf ) { - char TaskName[16]; - - /* - ** Get the task name - */ - strncpy(TaskName, "TBD", 16); - - if ( TaskName == NULL ) - { - sprintf(CFE_PSP_ExceptionReasonString, "Exception: Vector=0x%06X, vxWorks Task Name=NULL, Task ID=0x%08X", - vector,task_id); - } - else - { - sprintf(CFE_PSP_ExceptionReasonString, "Exception: Vector=0x%06X, vxWorks Task Name=%s, Task ID=0x%08X", - vector, TaskName, task_id); - } + sprintf(CFE_PSP_ExceptionReasonString, "Not Implemented"); /* ** Save Exception Stack frame diff --git a/fsw/shared/cfe_psp_module.c b/fsw/shared/cfe_psp_module.c index bdff2f05..6f0b3c52 100644 --- a/fsw/shared/cfe_psp_module.c +++ b/fsw/shared/cfe_psp_module.c @@ -108,7 +108,7 @@ int32 CFE_PSP_Module_GetAPIEntry(uint32 PspModuleId, CFE_PSP_ModuleApi_t **API) * * See prototype for full description */ -int32 CFE_PSP_Module_FindByName(const char *DriverName, uint32 *PspModuleId) +int32 CFE_PSP_Module_FindByName(const char *ModuleName, uint32 *PspModuleId) { uint32 i; int32 Result; @@ -119,7 +119,7 @@ int32 CFE_PSP_Module_FindByName(const char *DriverName, uint32 *PspModuleId) i = 0; while (i < CFE_PSP_ModuleCount) { - if (strcmp(Entry->Name, DriverName) == 0) + if (strcmp(Entry->Name, ModuleName) == 0) { *PspModuleId = CFE_PSP_MODULE_BASE | (i & CFE_PSP_MODULE_INDEX_MASK); Result = CFE_PSP_SUCCESS;