From bf8d4b94793eaf6e8ba1c694fcdb2885d75d61e3 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 27 Jan 2021 19:28:56 +0100 Subject: score: Add _Thread_Get_objects_information() We do not need all the checks if we have a valid indentifier to a thread class object. Using the new _Thread_Get_objects_information() instead of the inline function _Thread_Get_objects_information_by_id() avoids dead code since the identifier in a thread control is always valid and the return NULL path in _Thread_Get_objects_information_by_id() would be dead code. The _Thread_Get_objects_information_by_id() should be an inline function since it is used by _Thread_Get() and thus performance critical. Static analyzers which cannot derive that the identifier in a thread control is always valid, may find a potential NULL pointer access (or otherwise find dead code). The identifier in an object control is always valid, see _Objects_Initialize_information() and _Objects_Extend_information(). Move _RTEMS_tasks_Free() to the only source file which calls this function. --- cpukit/rtems/src/taskconstruct.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cpukit/rtems') diff --git a/cpukit/rtems/src/taskconstruct.c b/cpukit/rtems/src/taskconstruct.c index 6ff83a0b9c..d33a850d88 100644 --- a/cpukit/rtems/src/taskconstruct.c +++ b/cpukit/rtems/src/taskconstruct.c @@ -79,6 +79,14 @@ rtems_status_code rtems_task_construct( return _RTEMS_tasks_Create( config, id, _RTEMS_tasks_Prepare_user_stack ); } +static void _RTEMS_tasks_Free( Thread_Control *the_thread ) +{ + Thread_Information *information; + + information = _Thread_Get_objects_information( the_thread ); + _Objects_Free( &information->Objects, &the_thread->Object ); +} + rtems_status_code _RTEMS_tasks_Create( const rtems_task_config *config, rtems_id *id, -- cgit v1.2.3