You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2019/05/09 00:10:24 UTC

[mynewt-core] branch master updated (e48eb56 -> b3b43cf)

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

ccollins pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.


    from e48eb56  [STM32] SPI - fix usage of unitialized variable
     new fc99c1b  kernel/os: Assert that eventq is valid before put
     new b3b43cf  sys/config: Only use the dflt evq if it exists

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 kernel/os/src/os_eventq.c |  2 ++
 sys/config/src/config.c   | 10 ++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)


[mynewt-core] 01/02: kernel/os: Assert that eventq is valid before put

Posted by cc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit fc99c1b4c519caafdf2cb63b3478e135ce14c6e3
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Wed May 8 14:49:11 2019 -0700

    kernel/os: Assert that eventq is valid before put
    
    Trigger a crash if the application attempts to put an event on a null or
    uninitialized event queue.  Without the assert, both of these conditions
    can put the system in a strange state: the event "thinks" it is
    enqueued, but it is not actually present in the eventq's list.  As a
    consequence, the event never gets processed, and it is impossible to
    queue the event again because it thinks it is already enqueued.
---
 kernel/os/src/os_eventq.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/os/src/os_eventq.c b/kernel/os/src/os_eventq.c
index 77918be..b3d4d7f 100644
--- a/kernel/os/src/os_eventq.c
+++ b/kernel/os/src/os_eventq.c
@@ -46,6 +46,8 @@ os_eventq_put(struct os_eventq *evq, struct os_event *ev)
     int resched;
     os_sr_t sr;
 
+    assert(evq != NULL && os_eventq_inited(evq));
+
     os_trace_api_u32x2(OS_TRACE_ID_EVENTQ_PUT, (uint32_t)evq, (uint32_t)ev);
 
     OS_ENTER_CRITICAL(sr);


[mynewt-core] 02/02: sys/config: Only use the dflt evq if it exists

Posted by cc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit b3b43cf727921713f6382e973f7da92f1030b1f9
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Wed May 8 14:51:09 2019 -0700

    sys/config: Only use the dflt evq if it exists
    
    If OS_SCHEDULING is disabled, the default event queue never gets
    initialized.  Don't put an event on an uninitialized event queue.
---
 sys/config/src/config.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sys/config/src/config.c b/sys/config/src/config.c
index 9d06e73..ecd6b28 100644
--- a/sys/config/src/config.c
+++ b/sys/config/src/config.c
@@ -28,14 +28,16 @@
 
 struct conf_handler_head conf_handlers;
 
-static os_event_fn conf_ev_fn_load;
-
 static struct os_mutex conf_mtx;
 
+#if MYNEWT_VAL(OS_SCHEDULING)
+static os_event_fn conf_ev_fn_load;
+
 /* OS event - causes persisted config values to be loaded at startup. */
 static struct os_event conf_ev_load = {
     .ev_cb = conf_ev_fn_load,
 };
+#endif
 
 void
 conf_init(void)
@@ -62,7 +64,9 @@ conf_init(void)
      * processed.  This gives main() a chance to configure the underlying
      * storage first.
      */
+#if MYNEWT_VAL(OS_SCHEDULING)
     os_eventq_put(os_eventq_dflt_get(), &conf_ev_load);
+#endif
 }
 
 void
@@ -86,11 +90,13 @@ conf_register(struct conf_handler *handler)
     return 0;
 }
 
+#if MYNEWT_VAL(OS_SCHEDULING)
 static void
 conf_ev_fn_load(struct os_event *ev)
 {
     conf_ensure_loaded();
 }
+#endif
 
 /*
  * Find conf_handler based on name.