mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 11:26:12 +08:00
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
This commit is contained in:
@@ -462,8 +462,7 @@ static void sporadic_budget_expire(wdparm_t arg)
|
|||||||
|
|
||||||
if (nxsched_islocked_tcb(tcb))
|
if (nxsched_islocked_tcb(tcb))
|
||||||
{
|
{
|
||||||
DEBUGASSERT((mrepl->flags && SPORADIC_FLAG_ALLOCED) != 0 &&
|
DEBUGASSERT((mrepl->flags && SPORADIC_FLAG_ALLOCED) != 0);
|
||||||
sporadic->nrepls > 0);
|
|
||||||
|
|
||||||
/* Set the timeslice to the magic value */
|
/* 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
|
/* 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
|
* replenishment timer for the time since we were suspended (which might
|
||||||
* as long as the whole budget interval).
|
* be as long as the whole budget interval).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sporadic = tcb->sporadic;
|
sporadic = tcb->sporadic;
|
||||||
@@ -487,7 +486,7 @@ static void sporadic_budget_expire(wdparm_t arg)
|
|||||||
{
|
{
|
||||||
uint32_t unrealized;
|
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
|
* suspended (or which the budget interval was started in the case
|
||||||
* that the thread was delayed for the entire interval).
|
* that the thread was delayed for the entire interval).
|
||||||
*/
|
*/
|
||||||
@@ -508,7 +507,7 @@ static void sporadic_budget_expire(wdparm_t arg)
|
|||||||
|
|
||||||
uint32_t period;
|
uint32_t period;
|
||||||
|
|
||||||
DEBUGASSERT(unrealized <= (sporadic->repl_period >> 1))
|
DEBUGASSERT(unrealized <= (sporadic->repl_period >> 1));
|
||||||
period = (sporadic->repl_period >> 1) - unrealized;
|
period = (sporadic->repl_period >> 1) - unrealized;
|
||||||
|
|
||||||
/* Start the delay into the next cycle to perform the
|
/* 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;
|
uint32_t period;
|
||||||
|
|
||||||
DEBUGASSERT(unrealized <= (sporadic->repl_period >> 1))
|
DEBUGASSERT(unrealized <= (sporadic->repl_period >> 1));
|
||||||
period = (sporadic->repl_period >> 1) - unrealized;
|
period = (sporadic->repl_period >> 1) - unrealized;
|
||||||
|
|
||||||
/* Start the delay into the next cycle to perform the
|
/* Start the delay into the next cycle to perform the
|
||||||
|
|||||||
Reference in New Issue
Block a user