sched/semaphore: remove redundant goto case

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2021-12-13 11:15:40 +08:00 committed by Masayuki Ishikawa
parent 102a6357ca
commit 4703ef93cc
2 changed files with 9 additions and 21 deletions

View File

@ -127,7 +127,7 @@ int nxsem_clockwait(FAR sem_t *sem, clockid_t clockid,
{
/* We got it! */
goto success_with_irqdisabled;
goto out;
}
/* We will have to wait for the semaphore. Make sure that we were provided
@ -137,7 +137,7 @@ int nxsem_clockwait(FAR sem_t *sem, clockid_t clockid,
if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
{
ret = -EINVAL;
goto errout_with_irqdisabled;
goto out;
}
/* Convert the timespec to clock ticks. We must have interrupts
@ -154,7 +154,7 @@ int nxsem_clockwait(FAR sem_t *sem, clockid_t clockid,
if (status == OK && ticks <= 0)
{
ret = -ETIMEDOUT;
goto errout_with_irqdisabled;
goto out;
}
/* Handle any time-related errors */
@ -162,7 +162,7 @@ int nxsem_clockwait(FAR sem_t *sem, clockid_t clockid,
if (status != OK)
{
ret = -status;
goto errout_with_irqdisabled;
goto out;
}
/* Start the watchdog */
@ -181,8 +181,7 @@ int nxsem_clockwait(FAR sem_t *sem, clockid_t clockid,
/* We can now restore interrupts and delete the watchdog */
success_with_irqdisabled:
errout_with_irqdisabled:
out:
leave_critical_section(flags);
return ret;
}

View File

@ -94,7 +94,7 @@ int nxsem_tickwait(FAR sem_t *sem, clock_t start, uint32_t delay)
{
/* We got it! */
goto success_with_irqdisabled;
goto out;
}
/* We will have to wait for the semaphore. Make sure that we were provided
@ -105,7 +105,7 @@ int nxsem_tickwait(FAR sem_t *sem, clock_t start, uint32_t delay)
{
/* Return the errno from nxsem_trywait() */
goto errout_with_irqdisabled;
goto out;
}
/* Adjust the delay for any time since the delay was calculated */
@ -114,7 +114,7 @@ int nxsem_tickwait(FAR sem_t *sem, clock_t start, uint32_t delay)
if (/* elapsed >= (UINT32_MAX / 2) || */ elapsed >= delay)
{
ret = -ETIMEDOUT;
goto errout_with_irqdisabled;
goto out;
}
delay -= elapsed;
@ -131,20 +131,9 @@ int nxsem_tickwait(FAR sem_t *sem, clock_t start, uint32_t delay)
wd_cancel(&rtcb->waitdog);
if (ret < 0)
{
goto errout_with_irqdisabled;
}
/* We can now restore interrupts */
/* Success exits */
success_with_irqdisabled:
/* Error exits */
errout_with_irqdisabled:
out:
leave_critical_section(flags);
return ret;
}