From 97b5dec91232b46187ac8f30e092295a8070ba40 Mon Sep 17 00:00:00 2001 From: wangchengdong Date: Mon, 3 Nov 2025 17:11:16 +0800 Subject: [PATCH 1/2] sched/event: Fix uninitialized need_switch flag issue in event_post() The `need_switch` flag was not initialized in `event_post()`. Since it is a local variable, it could contain a random non-zero value, leading to incorrect behavior. In addition, this patch also fixes an issue where the event clearing operation in `event_post()` was not performed correctly. Signed-off-by: Chengdong Wang wangchengdong@lixiang.com --- sched/event/event_post.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sched/event/event_post.c b/sched/event/event_post.c index 03ae633142b95..3efc3f7d64dae 100644 --- a/sched/event/event_post.c +++ b/sched/event/event_post.c @@ -68,7 +68,7 @@ int nxevent_post(FAR nxevent_t *event, nxevent_mask_t events, dq_queue_t *waitlist; bool waitall; bool postall; - bool need_switch; + bool need_switch = false; if (event == NULL) { @@ -133,11 +133,11 @@ int nxevent_post(FAR nxevent_t *event, nxevent_mask_t events, break; } } + } - if (clear) - { - event->events &= ~clear; - } + if (clear != 0) + { + event->events &= ~clear; } if (need_switch) From d89827a7ff934686b8f3fd713037e8ac88b9097c Mon Sep 17 00:00:00 2001 From: wangchengdong Date: Mon, 3 Nov 2025 20:31:25 +0800 Subject: [PATCH 2/2] arch: Enable event module for pcduino-a10 and smartl-c906 Enable the event module on pcduino-a10 and smartl-c906 boards to allow event tests to be executed on both ARM and RISC-V architectures. Signed-off-by: Chengdong Wang --- boards/arm/a1x/pcduino-a10/configs/nsh/defconfig | 2 +- boards/risc-v/c906/smartl-c906/configs/nsh/defconfig | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/boards/arm/a1x/pcduino-a10/configs/nsh/defconfig b/boards/arm/a1x/pcduino-a10/configs/nsh/defconfig index 2fe5cb645e993..7565adfb0721e 100644 --- a/boards/arm/a1x/pcduino-a10/configs/nsh/defconfig +++ b/boards/arm/a1x/pcduino-a10/configs/nsh/defconfig @@ -27,7 +27,6 @@ CONFIG_FAT_LFN=y CONFIG_FS_FAT=y CONFIG_HAVE_CXX=y CONFIG_HAVE_CXXINITIALIZE=y -CONFIG_HOST_WINDOWS=y CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_INTELHEX_BINARY=y CONFIG_NSH_BUILTIN_APPS=y @@ -39,6 +38,7 @@ CONFIG_RAM_START=0x4a000000 CONFIG_RAM_VSTART=0x4a000000 CONFIG_RAW_BINARY=y CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_EVENTS=y CONFIG_SCHED_WAITPID=y CONFIG_START_DAY=31 CONFIG_START_MONTH=7 diff --git a/boards/risc-v/c906/smartl-c906/configs/nsh/defconfig b/boards/risc-v/c906/smartl-c906/configs/nsh/defconfig index 55ecddf057845..eb48db2c37c06 100644 --- a/boards/risc-v/c906/smartl-c906/configs/nsh/defconfig +++ b/boards/risc-v/c906/smartl-c906/configs/nsh/defconfig @@ -44,6 +44,7 @@ CONFIG_RAM_START=0x00300000 CONFIG_RAW_BINARY=y CONFIG_READLINE_CMD_HISTORY=y CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_EVENTS=y CONFIG_SCHED_HPWORK=y CONFIG_SCHED_LPWORK=y CONFIG_SCHED_WAITPID=y