sched/assert: Simplify the fatal detection logic

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-04-04 02:30:39 +08:00 committed by hartmannathan
parent 4fbf5f7a4b
commit 84ddfb5455

View File

@ -423,20 +423,18 @@ void _assert(FAR const char *filename, int linenum, FAR const char *msg)
{
FAR struct tcb_s *rtcb = running_task();
struct utsname name;
bool fatal = false;
bool fatal = true;
/* Flush any buffered SYSLOG data (from prior to the assertion) */
syslog_flush();
#if CONFIG_BOARD_RESET_ON_ASSERT < 2
if (up_interrupt_context() ||
(rtcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
if (!up_interrupt_context() &&
(rtcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL)
{
fatal = true;
fatal = false;
}
#else
fatal = true;
#endif
panic_notifier_call_chain(fatal ? PANIC_KERNEL : PANIC_TASK, rtcb);