sched/backtrace: simplify the assign of tcb in case of negative pid

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an
2021-08-20 13:36:39 +08:00
committed by Gustavo Henrique Nihei
parent e092c457e6
commit 904348302a
+6 -11
View File
@@ -42,20 +42,15 @@
int sched_backtrace(pid_t tid, FAR void **buffer, int size)
{
FAR struct tcb_s *rtcb;
FAR struct tcb_s *rtcb = NULL;
if (tid < 0)
{
rtcb = running_task();
}
else
if (tid >= 0)
{
rtcb = nxsched_get_tcb(tid);
}
if (rtcb == NULL)
{
return 0;
if (rtcb == NULL)
{
return 0;
}
}
return up_backtrace(rtcb, buffer, size);