This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 23e9489345 sched/mqueue: correct list parameter
23e9489345 is described below

commit 23e9489345a9457dd10623981125a7b453ec9dcd
Author: chao an <anc...@lixiang.com>
AuthorDate: Thu Apr 11 15:36:29 2024 +0800

    sched/mqueue: correct list parameter
    
    1. correct list parameter
    2. move global data to bss
    
    Signed-off-by: chao an <anc...@lixiang.com>
---
 sched/mqueue/mq_initialize.c | 12 +++++++++---
 sched/mqueue/msginternal.c   |  2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/sched/mqueue/mq_initialize.c b/sched/mqueue/mq_initialize.c
index d5646e07c5..b0cc3ea5a9 100644
--- a/sched/mqueue/mq_initialize.c
+++ b/sched/mqueue/mq_initialize.c
@@ -42,13 +42,13 @@
  * item.
  */
 
-struct list_node g_msgfree = LIST_INITIAL_VALUE(g_msgfree);
+struct list_node g_msgfree;
 
 /* The g_msgfreeInt is a list of messages that are reserved for use by
  * interrupt handlers.
  */
 
-struct list_node g_msgfreeirq = LIST_INITIAL_VALUE(g_msgfreeirq);
+struct list_node g_msgfreeirq;
 
 #endif
 
@@ -95,7 +95,7 @@ static FAR void *sysv_msgblockinit(FAR struct list_node *list,
   int i;
   for (i = 0; i < nmsgs; i++)
     {
-      list_add_tail(&g_msgfreelist, &msg->node);
+      list_add_tail(list, &msg->node);
       msg++;
     }
 
@@ -144,6 +144,8 @@ void nxmq_initialize(void)
   /* Initialize a block of messages for general use */
 
 #ifndef CONFIG_DISABLE_MQUEUE
+  list_initialize(&g_msgfree);
+
   msg = mq_msgblockinit(&g_msgfree, msg, CONFIG_PREALLOC_MQ_MSGS,
                          MQ_ALLOC_FIXED);
 
@@ -151,11 +153,15 @@ void nxmq_initialize(void)
    * interrupt handlers
    */
 
+  list_initialize(&g_msgfreeirq);
+
   msg = mq_msgblockinit(&g_msgfreeirq, msg, CONFIG_PREALLOC_MQ_IRQ_MSGS,
                          MQ_ALLOC_IRQ);
 #endif
 
 #ifndef CONFIG_DISABLE_MQUEUE_SYSV
+  list_initialize(&g_msgfreelist);
+
   msg = sysv_msgblockinit(&g_msgfreelist, msg, CONFIG_PREALLOC_MQ_MSGS);
 #endif
 
diff --git a/sched/mqueue/msginternal.c b/sched/mqueue/msginternal.c
index 4d7f30af07..712678fb3e 100644
--- a/sched/mqueue/msginternal.c
+++ b/sched/mqueue/msginternal.c
@@ -42,7 +42,7 @@ static FAR struct msgq_s **g_msgqs; /* The pointer of two 
layer file descriptors
  * Public Data
  ****************************************************************************/
 
-struct list_node g_msgfreelist = LIST_INITIAL_VALUE(g_msgfreelist);
+struct list_node g_msgfreelist;
 
 /****************************************************************************
  * Private Functions

Reply via email to