-
Notifications
You must be signed in to change notification settings - Fork 71
Description
Describe the bug
For PSP modules the initialization is only called if the module type is "SIMPLE" - but this is not necessary to enforce, because the intent is to allow this to be extended to other module types as the mission requires.
Since the "Init" function pointer is a fixed/defined entry (so all modules have it, regardless of type) and it is already permitted to be NULL if it is not needed, then there is no real reason to restrict calling it to the "SIMPLE" module type.
To Reproduce
Define an extension module type and try to use it with Caelum. It will not be initialized as expected, the init call is skipped.
Expected behavior
If a module provides an init function, it should be called, regardless of whether the module type is "SIMPLE" or something else.
Code snips
Check is here:
PSP/fsw/shared/src/cfe_psp_module.c
Line 67 in 6d40816
| if ((uint32)ApiPtr->ModuleType == CFE_PSP_MODULE_TYPE_SIMPLE && ApiPtr->Init != NULL) |
Through some form of evolution it was checking specifically for CFE_PSP_MODULE_TYPE_SIMPLE only, but it would be better to check that ModuleType != CFE_PSP_MODULE_TYPE_INVALID instead.
System observed on:
Ubuntu
Additional context
Only breaks when trying to add modules of other types (extensions). Could theoretically be fixed in other ways, but still, the intent of this code is only to confirm that the module structure is initialized to something before invoking a function pointer. So it is more correct to check that it is not invalid, rather than checking specifically for one value.
Reporter Info
Joseph Hickey, Vantage Systems, Inc.