Skip to content

Commit

Permalink
note: handle tcb is empty, so that it can also record before the driv…
Browse files Browse the repository at this point in the history
…er initialization

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
  • Loading branch information
Gary-Hobson authored and xiaoxiang781216 committed Feb 24, 2023
1 parent 38f64f5 commit 9ed1519
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions drivers/note/note_driver.c
Expand Up @@ -237,11 +237,24 @@ static void note_common(FAR struct tcb_s *tcb,

note->nc_length = length;
note->nc_type = type;
note->nc_priority = tcb->sched_priority;

if (tcb == NULL)
{
note->nc_priority = CONFIG_INIT_PRIORITY;
#ifdef CONFIG_SMP
note->nc_cpu = tcb->cpu;
note->nc_cpu = 0;
#endif
sched_note_flatten(note->nc_pid, &tcb->pid, sizeof(tcb->pid));
memset(note->nc_pid, 0, sizeof(tcb->pid));
}
else
{
note->nc_priority = tcb->sched_priority;
#ifdef CONFIG_SMP
note->nc_cpu = tcb->cpu;
#endif
sched_note_flatten(note->nc_pid, &tcb->pid, sizeof(tcb->pid));
}

sched_note_flatten(note->nc_systime_nsec, &ts.tv_nsec, sizeof(ts.tv_nsec));
sched_note_flatten(note->nc_systime_sec, &ts.tv_sec, sizeof(ts.tv_sec));
}
Expand Down

0 comments on commit 9ed1519

Please sign in to comment.