[rtems commit] score: Add comments and asserts for clarification
Sebastian Huber
sebh at rtems.org
Mon Feb 1 06:20:12 UTC 2021
Module: rtems
Branch: master
Commit: 450c170536391f094bbd501afae0cce05072a87d
Changeset: http://git.rtems.org/rtems/commit/?id=450c170536391f094bbd501afae0cce05072a87d
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Jan 28 11:35:18 2021 +0100
score: Add comments and asserts for clarification
This fix relates to a Coverity issue (NULL_RETURNS).
---
cpukit/include/rtems/score/priorityimpl.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/cpukit/include/rtems/score/priorityimpl.h b/cpukit/include/rtems/score/priorityimpl.h
index 1a7f90a..7a14ec9 100644
--- a/cpukit/include/rtems/score/priorityimpl.h
+++ b/cpukit/include/rtems/score/priorityimpl.h
@@ -613,7 +613,9 @@ RTEMS_INLINE_ROUTINE void _Priority_Extract(
} else {
Priority_Node *min;
+ /* The aggregation is non-empty, so the minimum node exists. */
min = _Priority_Get_minimum_node( aggregation );
+ _Assert( min != NULL );
if ( node->priority < min->priority ) {
aggregation->Node.priority = min->priority;
@@ -684,7 +686,12 @@ RTEMS_INLINE_ROUTINE void _Priority_Changed(
_Priority_Plain_changed( aggregation, node );
+ /*
+ * There is at least the changed node in the aggregation, so the minimum node
+ * exists.
+ */
min = _Priority_Get_minimum_node( aggregation );
+ _Assert( min != NULL );
if ( min->priority != aggregation->Node.priority ) {
aggregation->Node.priority = min->priority;
More information about the vc
mailing list