mirror of
https://github.com/apache/nuttx.git
synced 2026-06-01 16:59:28 +08:00
sched/semaphore: remove redundant goto case
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
committed by
Masayuki Ishikawa
parent
102a6357ca
commit
4703ef93cc
@@ -127,7 +127,7 @@ int nxsem_clockwait(FAR sem_t *sem, clockid_t clockid,
|
|||||||
{
|
{
|
||||||
/* We got it! */
|
/* We got it! */
|
||||||
|
|
||||||
goto success_with_irqdisabled;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We will have to wait for the semaphore. Make sure that we were provided
|
/* 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)
|
if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
|
||||||
{
|
{
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto errout_with_irqdisabled;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert the timespec to clock ticks. We must have interrupts
|
/* 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)
|
if (status == OK && ticks <= 0)
|
||||||
{
|
{
|
||||||
ret = -ETIMEDOUT;
|
ret = -ETIMEDOUT;
|
||||||
goto errout_with_irqdisabled;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle any time-related errors */
|
/* Handle any time-related errors */
|
||||||
@@ -162,7 +162,7 @@ int nxsem_clockwait(FAR sem_t *sem, clockid_t clockid,
|
|||||||
if (status != OK)
|
if (status != OK)
|
||||||
{
|
{
|
||||||
ret = -status;
|
ret = -status;
|
||||||
goto errout_with_irqdisabled;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start the watchdog */
|
/* 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 */
|
/* We can now restore interrupts and delete the watchdog */
|
||||||
|
|
||||||
success_with_irqdisabled:
|
out:
|
||||||
errout_with_irqdisabled:
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ int nxsem_tickwait(FAR sem_t *sem, clock_t start, uint32_t delay)
|
|||||||
{
|
{
|
||||||
/* We got it! */
|
/* We got it! */
|
||||||
|
|
||||||
goto success_with_irqdisabled;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We will have to wait for the semaphore. Make sure that we were provided
|
/* 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() */
|
/* Return the errno from nxsem_trywait() */
|
||||||
|
|
||||||
goto errout_with_irqdisabled;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adjust the delay for any time since the delay was calculated */
|
/* 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)
|
if (/* elapsed >= (UINT32_MAX / 2) || */ elapsed >= delay)
|
||||||
{
|
{
|
||||||
ret = -ETIMEDOUT;
|
ret = -ETIMEDOUT;
|
||||||
goto errout_with_irqdisabled;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
delay -= elapsed;
|
delay -= elapsed;
|
||||||
@@ -131,20 +131,9 @@ int nxsem_tickwait(FAR sem_t *sem, clock_t start, uint32_t delay)
|
|||||||
|
|
||||||
wd_cancel(&rtcb->waitdog);
|
wd_cancel(&rtcb->waitdog);
|
||||||
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
goto errout_with_irqdisabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We can now restore interrupts */
|
/* We can now restore interrupts */
|
||||||
|
|
||||||
/* Success exits */
|
out:
|
||||||
|
|
||||||
success_with_irqdisabled:
|
|
||||||
|
|
||||||
/* Error exits */
|
|
||||||
|
|
||||||
errout_with_irqdisabled:
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user