mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
task_getpid.c:coverity HIS_metric_violation: RETURN
Use a local ret variable and return once at the end. This keeps the IDLE_PROCESS_ID fallback behavior unchanged. Addresses Coverity HIS_metric_violation: RETURN. Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
This commit is contained in:
parent
bb8d16f422
commit
d2b87c7189
1 changed files with 3 additions and 6 deletions
|
|
@ -56,6 +56,7 @@
|
|||
pid_t nxsched_getpid(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb;
|
||||
pid_t ret = IDLE_PROCESS_ID;
|
||||
|
||||
/* Get the TCB at the head of the ready-to-run task list. That
|
||||
* will usually be the currently executing task. There is are two
|
||||
|
|
@ -71,12 +72,8 @@ pid_t nxsched_getpid(void)
|
|||
{
|
||||
/* Yes.. Return the Process ID */
|
||||
|
||||
return rtcb->group->tg_pid;
|
||||
ret = rtcb->group->tg_pid;
|
||||
}
|
||||
|
||||
/* We must have been called earlier in the start up sequence from the
|
||||
* start-up/IDLE thread before the ready-to-run list has been initialized.
|
||||
*/
|
||||
|
||||
return IDLE_PROCESS_ID;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue