Register a custom task stack allocator initialization handler only if necessary. --- cpukit/include/rtems/confdefs/wkspace.h | 19 +++++++++++-------- cpukit/score/src/stackallocatorinit.c | 5 +---- 2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/cpukit/include/rtems/confdefs/wkspace.h b/cpukit/include/rtems/confdefs/wkspace.h index de555101a1..78d669d790 100644 --- a/cpukit/include/rtems/confdefs/wkspace.h +++ b/cpukit/include/rtems/confdefs/wkspace.h @@ -144,10 +144,19 @@ const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE; #endif #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_INIT + RTEMS_STATIC_ASSERT( + CONFIGURE_TASK_STACK_ALLOCATOR_INIT != NULL, + CONFIGURE_TASK_STACK_ALLOCATOR_INIT_MUST_NOT_BE_NULL + ); + const Stack_Allocator_initialize _Stack_Allocator_initialize = CONFIGURE_TASK_STACK_ALLOCATOR_INIT; - #else - const Stack_Allocator_initialize _Stack_Allocator_initialize = NULL; + + RTEMS_SYSINIT_ITEM( + _Stack_Allocator_do_initialize, + RTEMS_SYSINIT_DIRTY_MEMORY, + RTEMS_SYSINIT_ORDER_MIDDLE + ); #endif RTEMS_STATIC_ASSERT( @@ -165,12 +174,6 @@ const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE; const Stack_Allocator_free _Stack_Allocator_free = CONFIGURE_TASK_STACK_DEALLOCATOR; - - RTEMS_SYSINIT_ITEM( - _Stack_Allocator_do_initialize, - RTEMS_SYSINIT_DIRTY_MEMORY, - RTEMS_SYSINIT_ORDER_MIDDLE - ); #elif defined(CONFIGURE_TASK_STACK_ALLOCATOR) \ || defined(CONFIGURE_TASK_STACK_DEALLOCATOR) #error "CONFIGURE_TASK_STACK_ALLOCATOR and CONFIGURE_TASK_STACK_DEALLOCATOR must be both defined or both undefined" diff --git a/cpukit/score/src/stackallocatorinit.c b/cpukit/score/src/stackallocatorinit.c index 412e3142b3..31e239bd46 100644 --- a/cpukit/score/src/stackallocatorinit.c +++ b/cpukit/score/src/stackallocatorinit.c @@ -45,8 +45,5 @@ void _Stack_Allocator_do_initialize( void ) rtems_stack_allocate_init_hook init_hook; init_hook = rtems_configuration_get_stack_allocate_init_hook(); - - if ( init_hook != NULL ) { - (*init_hook )( rtems_configuration_get_stack_space_size() ); - } + ( *init_hook )( rtems_configuration_get_stack_space_size() ); } -- 2.26.2 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel