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

raiden00 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 87d57d283e Fix timers/arch_alarm.c:109:3: error: 'now' may be used 
uninitialized
87d57d283e is described below

commit 87d57d283e91e5c9a487dc44af10335bb2bb4b86
Author: Xiang Xiao <[email protected]>
AuthorDate: Wed Nov 13 16:00:05 2024 +0800

    Fix timers/arch_alarm.c:109:3: error: 'now' may be used uninitialized
    
    and timers/arch_alarm.c:150:51: error: 'ticks' may be used uninitialized
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 drivers/timers/arch_alarm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/timers/arch_alarm.c b/drivers/timers/arch_alarm.c
index d558410f71..64c7a7a7d3 100644
--- a/drivers/timers/arch_alarm.c
+++ b/drivers/timers/arch_alarm.c
@@ -102,9 +102,9 @@ static void udelay_coarse(useconds_t microseconds)
 static void oneshot_callback(FAR struct oneshot_lowerhalf_s *lower,
                              FAR void *arg)
 {
-  clock_t now;
-  ONESHOT_TICK_CURRENT(g_oneshot_lower, &now);
+  clock_t now = 0;
 
+  ONESHOT_TICK_CURRENT(g_oneshot_lower, &now);
 #ifdef CONFIG_SCHED_TICKLESS
   nxsched_alarm_tick_expiration(now);
 #else
@@ -140,7 +140,7 @@ static void oneshot_callback(FAR struct oneshot_lowerhalf_s 
*lower,
 void up_alarm_set_lowerhalf(FAR struct oneshot_lowerhalf_s *lower)
 {
 #ifdef CONFIG_SCHED_TICKLESS
-  clock_t ticks;
+  clock_t ticks = 0;
 #endif
 
   g_oneshot_lower = lower;
@@ -318,7 +318,7 @@ int weak_function up_alarm_tick_start(clock_t ticks)
 
   if (g_oneshot_lower != NULL)
     {
-      clock_t now;
+      clock_t now = 0;
       clock_t delta;
 
       ONESHOT_TICK_CURRENT(g_oneshot_lower, &now);

Reply via email to