[rtems commit] rtems: Use _Objects_Free_nothing() for msg queues
Sebastian Huber
sebh at rtems.org
Tue May 11 05:49:44 UTC 2021
Module: rtems
Branch: master
Commit: c2687666b199c44dacfa8d5e9b9939fa2dc8521e
Changeset: http://git.rtems.org/rtems/commit/?id=c2687666b199c44dacfa8d5e9b9939fa2dc8521e
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Mon May 10 09:39:35 2021 +0200
rtems: Use _Objects_Free_nothing() for msg queues
Use _Objects_Free_nothing() for rtems_message_queue_construct() to avoid
unreachable code in _CORE_message_queue_Close() in case only
user-provided message buffers are used.
Update #4007.
---
cpukit/rtems/src/msgqconstruct.c | 7 ++++++-
cpukit/score/src/coremsgclose.c | 8 +++-----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/cpukit/rtems/src/msgqconstruct.c b/cpukit/rtems/src/msgqconstruct.c
index 6af5745..63ec75e 100644
--- a/cpukit/rtems/src/msgqconstruct.c
+++ b/cpukit/rtems/src/msgqconstruct.c
@@ -41,7 +41,12 @@ static void *_Message_queue_Get_buffers(
return NULL;
}
- the_message_queue->free_message_buffers = config->storage_free;
+ if ( config->storage_free != NULL ) {
+ the_message_queue->free_message_buffers = config->storage_free;
+ } else {
+ the_message_queue->free_message_buffers = _Objects_Free_nothing;
+ }
+
return config->storage_area;
}
diff --git a/cpukit/score/src/coremsgclose.c b/cpukit/score/src/coremsgclose.c
index 1610d81..aae3d5a 100644
--- a/cpukit/score/src/coremsgclose.c
+++ b/cpukit/score/src/coremsgclose.c
@@ -51,11 +51,9 @@ void _CORE_message_queue_Close(
queue_context
);
- if ( the_message_queue->free_message_buffers != NULL ) {
- ( *the_message_queue->free_message_buffers )(
- the_message_queue->message_buffers
- );
- }
+ ( *the_message_queue->free_message_buffers )(
+ the_message_queue->message_buffers
+ );
_Thread_queue_Destroy( &the_message_queue->Wait_queue );
}
More information about the vc
mailing list