From 374f1bd46c2c7ece428cd24faebbe12f83b512c4 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 2 Oct 2017 14:04:25 -0600 Subject: [PATCH] binfmt: Don't schedule starthook if there are no constructors. --- binfmt/binfmt_execmodule.c | 5 ++++- configs/stm32f4discovery/src/stm32_bringup.c | 2 +- sched/task/task_start.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/binfmt/binfmt_execmodule.c b/binfmt/binfmt_execmodule.c index eef50068a53..d5fd06771c5 100644 --- a/binfmt/binfmt_execmodule.c +++ b/binfmt/binfmt_execmodule.c @@ -276,7 +276,10 @@ int exec_module(FAR const struct binary_s *binp) * until the new task has been started. */ - task_starthook(tcb, exec_ctors, (FAR void *)binp); + if (binp->nctors > 0) + { + task_starthook(tcb, exec_ctors, (FAR void *)binp); + } #endif /* Get the assigned pid before we start the task */ diff --git a/configs/stm32f4discovery/src/stm32_bringup.c b/configs/stm32f4discovery/src/stm32_bringup.c index 0997c941389..22fbf97830b 100644 --- a/configs/stm32f4discovery/src/stm32_bringup.c +++ b/configs/stm32f4discovery/src/stm32_bringup.c @@ -68,7 +68,7 @@ #include "stm32f4discovery.h" -/* Conditional logic in stm32f4discover.h will determine if certain features +/* Conditional logic in stm32f4discovery.h will determine if certain features * are supported. Tests for these features need to be made after including * stm32f4discovery.h. */ diff --git a/sched/task/task_start.c b/sched/task/task_start.c index 262c8f0b729..b1f1e3cd1a8 100644 --- a/sched/task/task_start.c +++ b/sched/task/task_start.c @@ -89,7 +89,7 @@ void task_start(void) /* Execute the start hook if one has been registered */ #ifdef CONFIG_SCHED_STARTHOOK - if (tcb->starthook) + if (tcb->starthook != NULL) { tcb->starthook(tcb->starthookarg); }