diff --git a/sched/semaphore/sem_clockwait.c b/sched/semaphore/sem_clockwait.c index 0b0db1cb3a..5e8f40e0db 100644 --- a/sched/semaphore/sem_clockwait.c +++ b/sched/semaphore/sem_clockwait.c @@ -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; } diff --git a/sched/semaphore/sem_tickwait.c b/sched/semaphore/sem_tickwait.c index 9b0e1c1997..fe30ba562b 100644 --- a/sched/semaphore/sem_tickwait.c +++ b/sched/semaphore/sem_tickwait.c @@ -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; }