kernel: mutex: Change variable declaration
This is not violating any MISRA-C rule, though, it seems to be
triggering a false (rule 9.1) positive in some static analysis
tools. Nevertheless, it is more readable declare all variables in the
same scope together.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
diff --git a/kernel/mutex.c b/kernel/mutex.c
index 2aaa81f..d198410 100644
--- a/kernel/mutex.c
+++ b/kernel/mutex.c
@@ -209,6 +209,7 @@
void _impl_k_mutex_unlock(struct k_mutex *mutex)
{
u32_t key;
+ struct k_thread *new_owner;
__ASSERT(mutex->lock_count > 0U, "");
__ASSERT(mutex->owner == _current, "");
@@ -230,7 +231,7 @@
adjust_owner_prio(mutex, mutex->owner_orig_prio);
- struct k_thread *new_owner = _unpend_first_thread(&mutex->wait_q);
+ new_owner = _unpend_first_thread(&mutex->wait_q);
mutex->owner = new_owner;