mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
sched/assert: Simplify the fatal detection logic
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
hartmannathan
parent
4fbf5f7a4b
commit
84ddfb5455
+4
-6
@@ -423,20 +423,18 @@ void _assert(FAR const char *filename, int linenum, FAR const char *msg)
|
|||||||
{
|
{
|
||||||
FAR struct tcb_s *rtcb = running_task();
|
FAR struct tcb_s *rtcb = running_task();
|
||||||
struct utsname name;
|
struct utsname name;
|
||||||
bool fatal = false;
|
bool fatal = true;
|
||||||
|
|
||||||
/* Flush any buffered SYSLOG data (from prior to the assertion) */
|
/* Flush any buffered SYSLOG data (from prior to the assertion) */
|
||||||
|
|
||||||
syslog_flush();
|
syslog_flush();
|
||||||
|
|
||||||
#if CONFIG_BOARD_RESET_ON_ASSERT < 2
|
#if CONFIG_BOARD_RESET_ON_ASSERT < 2
|
||||||
if (up_interrupt_context() ||
|
if (!up_interrupt_context() &&
|
||||||
(rtcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
|
(rtcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL)
|
||||||
{
|
{
|
||||||
fatal = true;
|
fatal = false;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
fatal = true;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
panic_notifier_call_chain(fatal ? PANIC_KERNEL : PANIC_TASK, rtcb);
|
panic_notifier_call_chain(fatal ? PANIC_KERNEL : PANIC_TASK, rtcb);
|
||||||
|
|||||||
Reference in New Issue
Block a user