sem_rw.c: coverity: HIS_metric_violation(HIS_GOTO)

This change replaces goto-based control flow with structured if-else blocks
in the up_read() function to comply with MISRA HIS coding standards while
maintaining identical functional behavior.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5
2025-08-14 19:22:56 +08:00
committed by Xiang Xiao
parent 53e9c5b986
commit 0f052df6db
+7 -8
View File
@@ -171,18 +171,17 @@ void up_read(FAR rw_semaphore_t *rwsem)
rwsem->holder = RWSEM_NO_HOLDER;
up_wait(rwsem);
}
goto out;
}
DEBUGASSERT(rwsem->reader > 0);
if (--rwsem->reader <= 0)
else
{
up_wait(rwsem);
DEBUGASSERT(rwsem->reader > 0);
if (--rwsem->reader <= 0)
{
up_wait(rwsem);
}
}
out:
nxmutex_unlock(&rwsem->protected);
}