From dc12e18e55c8fc5665e1afb9efc6bc5d653b6cab Mon Sep 17 00:00:00 2001 From: hujun5 Date: Mon, 26 Jan 2026 19:52:18 +0800 Subject: [PATCH 1/2] testing/ostest: fix uninitialized variable warning in wdog test Initialize the flags variable to 0 to fix compiler warning about potential use of uninitialized variable. The flags variable is conditionally assigned in wdtest_rand() based on callback count. Signed-off-by: hujun5 --- testing/ostest/wdog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/ostest/wdog.c b/testing/ostest/wdog.c index c00a7f9b6e0..273a680e916 100644 --- a/testing/ostest/wdog.c +++ b/testing/ostest/wdog.c @@ -147,7 +147,7 @@ static void wdtest_rand(FAR struct wdog_s *wdog, FAR wdtest_param_t *param, clock_t wdset_tick; sclock_t delay_tick; sclock_t diff; - irqstate_t flags; + irqstate_t flags = 0; /* Perform multiple iterations with random delays. */ From be9d6baeee4d7162c243554611d822328eb0b378 Mon Sep 17 00:00:00 2001 From: hujun5 Date: Tue, 27 Jan 2026 14:14:26 +0800 Subject: [PATCH 2/2] examples: foc: Add critical section protection to FOC control loop Introduce CONFIG_EXAMPLES_FOC_CONTROL_CRITSEC configuration option to enable critical section protection in the FOC (Field-Oriented Control) motor control examples. This adds irq-safe critical sections around the main control loop processing to prevent race conditions and ensure atomic updates of motor control state and parameters during interrupt handling. Signed-off-by: hujun5 --- examples/foc/foc_fixed16_thr.c | 2 ++ examples/foc/foc_float_thr.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/examples/foc/foc_fixed16_thr.c b/examples/foc/foc_fixed16_thr.c index 2ba2998e60e..3c9a8c77b29 100644 --- a/examples/foc/foc_fixed16_thr.c +++ b/examples/foc/foc_fixed16_thr.c @@ -26,6 +26,8 @@ #include +#include + #include #include #include diff --git a/examples/foc/foc_float_thr.c b/examples/foc/foc_float_thr.c index af967f255a3..4c52b86bf6e 100644 --- a/examples/foc/foc_float_thr.c +++ b/examples/foc/foc_float_thr.c @@ -26,6 +26,8 @@ #include +#include + #include #include #include