From 5b7dfa0213f1828e635cf152090cf8b7d1a18e27 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 19 Mar 2021 08:25:21 -0600 Subject: [PATCH] Sporadic scheduler: Fix compile errors when assertions are enabled: Fix missing semicolon at the end of a DEBUGASSERT statement: sched/sched_sporadic.c: In function 'sporadic_budget_expire': sched/sched_sporadic.c:512:15: error: expected ';' before 'period' 512 | period = (sporadic->repl_period >> 1) - unrealized; | ^~~~~~ sched/sched_sporadic.c: In function 'nxsched_resume_sporadic': sched/sched_sporadic.c:1078:19: error: expected ';' before 'period' 1078 | period = (sporadic->repl_period >> 1) - unrealized; | ^~~~~~ Fix use of uninitialized variable in DEBUGASSERT statement: sched/sched_sporadic.c:466:27: warning: 'sporadic' may be used uninitialized in this function [-Wmaybe-uninitialized] 466 | sporadic->nrepls > 0); Also fixes some typos. There should be no unexpected side-effects of this changed. Tested with the stm32f4discovery:sporadic configuration (see PR #3097 --- sched/sched/sched_sporadic.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sched/sched/sched_sporadic.c b/sched/sched/sched_sporadic.c index 00c3e88d66a..abd7c0b5be5 100644 --- a/sched/sched/sched_sporadic.c +++ b/sched/sched/sched_sporadic.c @@ -462,8 +462,7 @@ static void sporadic_budget_expire(wdparm_t arg) if (nxsched_islocked_tcb(tcb)) { - DEBUGASSERT((mrepl->flags && SPORADIC_FLAG_ALLOCED) != 0 && - sporadic->nrepls > 0); + DEBUGASSERT((mrepl->flags && SPORADIC_FLAG_ALLOCED) != 0); /* Set the timeslice to the magic value */ @@ -476,8 +475,8 @@ static void sporadic_budget_expire(wdparm_t arg) } /* Were we suspended at the end of the budget time? If so, start a new - * replenishment timer for the since we were suspended (which might be - * as long as the whole budget interval). + * replenishment timer for the time since we were suspended (which might + * be as long as the whole budget interval). */ sporadic = tcb->sporadic; @@ -487,7 +486,7 @@ static void sporadic_budget_expire(wdparm_t arg) { uint32_t unrealized; - /* The unrealized time is the interval from when the thread as + /* The unrealized time is the interval from when the thread was * suspended (or which the budget interval was started in the case * that the thread was delayed for the entire interval). */ @@ -508,7 +507,7 @@ static void sporadic_budget_expire(wdparm_t arg) uint32_t period; - DEBUGASSERT(unrealized <= (sporadic->repl_period >> 1)) + DEBUGASSERT(unrealized <= (sporadic->repl_period >> 1)); period = (sporadic->repl_period >> 1) - unrealized; /* Start the delay into the next cycle to perform the @@ -1074,7 +1073,7 @@ int nxsched_resume_sporadic(FAR struct tcb_s *tcb) uint32_t period; - DEBUGASSERT(unrealized <= (sporadic->repl_period >> 1)) + DEBUGASSERT(unrealized <= (sporadic->repl_period >> 1)); period = (sporadic->repl_period >> 1) - unrealized; /* Start the delay into the next cycle to perform the