From 37ecb28eb1d5b45a5af37bc03057792ec27928cd Mon Sep 17 00:00:00 2001 From: hujun5 Date: Mon, 14 Jul 2025 18:40:18 +0800 Subject: [PATCH] semaphore/sem_trywait.c: Remove redundancy leave_critical_section Remove redundant leave_critical_section() call in nxsem_trywait_slow() as the critical section is properly released at the exit point via 'out' label, making the intermediate call unnecessary and eliminating code duplication. Signed-off-by: hujun5 --- sched/semaphore/sem_trywait.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sched/semaphore/sem_trywait.c b/sched/semaphore/sem_trywait.c index 9dc0092a4a6..4f9ab9a4101 100644 --- a/sched/semaphore/sem_trywait.c +++ b/sched/semaphore/sem_trywait.c @@ -118,7 +118,6 @@ int nxsem_trywait_slow(FAR sem_t *sem) atomic_fetch_add(NXSEM_COUNT(sem), 1); } - leave_critical_section(flags); goto out; }