mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 20:44:39 +08:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user