From 2acafafae1e9c6253cf56cd429bb7b2ae2e287ef Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Thu, 23 Jul 2020 12:52:44 -0700 Subject: [PATCH] kernel: pipes: rename inner spinlock keys MISRA-C Rule 5.3 states that identifiers in inner scope should not hide identifiers in outer scope. There are a few spinlock keys simply named "key". So rename those in inner scope to avoid shadowing the outer ones. Signed-off-by: Daniel Leung --- kernel/pipes.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/pipes.c b/kernel/pipes.c index 9efe5999649..667cf22cd47 100644 --- a/kernel/pipes.c +++ b/kernel/pipes.c @@ -548,7 +548,7 @@ int z_pipe_put_internal(struct k_pipe *pipe, struct k_pipe_async *async_desc, * Lock interrupts and unlock the scheduler before * manipulating the writers wait_q. */ - k_spinlock_key_t key = k_spin_lock(&pipe->lock); + k_spinlock_key_t key2 = k_spin_lock(&pipe->lock); z_sched_unlock_no_reschedule(); async_desc->desc.buffer = data + num_bytes_written; @@ -557,7 +557,7 @@ int z_pipe_put_internal(struct k_pipe *pipe, struct k_pipe_async *async_desc, z_pend_thread((struct k_thread *) &async_desc->thread, &pipe->wait_q.writers, K_FOREVER); - z_reschedule(&pipe->lock, key); + z_reschedule(&pipe->lock, key2); return 0; } #endif @@ -573,9 +573,9 @@ int z_pipe_put_internal(struct k_pipe *pipe, struct k_pipe_async *async_desc, * Lock interrupts and unlock the scheduler before * manipulating the writers wait_q. */ - k_spinlock_key_t key = k_spin_lock(&pipe->lock); + k_spinlock_key_t key2 = k_spin_lock(&pipe->lock); z_sched_unlock_no_reschedule(); - (void)z_pend_curr(&pipe->lock, key, + (void)z_pend_curr(&pipe->lock, key2, &pipe->wait_q.writers, timeout); } else { k_sched_unlock(); @@ -725,10 +725,10 @@ int z_impl_k_pipe_get(struct k_pipe *pipe, void *data, size_t bytes_to_read, if (!K_TIMEOUT_EQ(timeout, K_NO_WAIT)) { _current->base.swap_data = &pipe_desc; - k_spinlock_key_t key = k_spin_lock(&pipe->lock); + k_spinlock_key_t key2 = k_spin_lock(&pipe->lock); z_sched_unlock_no_reschedule(); - (void)z_pend_curr(&pipe->lock, key, + (void)z_pend_curr(&pipe->lock, key2, &pipe->wait_q.readers, timeout); } else { k_sched_unlock();