From 1663ca8590bfa21a8041d81368db726deb573e2e Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Tue, 11 Sep 2018 19:32:59 -0700 Subject: [PATCH] kernel: Ignore _pend_current_thread return in some cases There are some cases that there is nothing to do with _pend_current_thread() return (that is _Swap return value). As MISRA-C requires that all non-void functions have their return value checked, we are explicitly ignoring it when there is nothing to do. Signed-off-by: Flavio Ceolin --- kernel/mempool.c | 2 +- kernel/pipes.c | 4 ++-- kernel/timer.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/mempool.c b/kernel/mempool.c index a08412bb6dd..3817e4e56a6 100644 --- a/kernel/mempool.c +++ b/kernel/mempool.c @@ -91,7 +91,7 @@ int k_mem_pool_alloc(struct k_mem_pool *p, struct k_mem_block *block, return ret; } - _pend_current_thread(irq_lock(), &p->wait_q, timeout); + (void)_pend_current_thread(irq_lock(), &p->wait_q, timeout); if (timeout != K_FOREVER) { timeout = end - _tick_get(); diff --git a/kernel/pipes.c b/kernel/pipes.c index 65c195ec06e..dba680699b4 100644 --- a/kernel/pipes.c +++ b/kernel/pipes.c @@ -565,7 +565,7 @@ int _k_pipe_put_internal(struct k_pipe *pipe, struct k_pipe_async *async_desc, */ key = irq_lock(); _sched_unlock_no_reschedule(); - _pend_current_thread(key, &pipe->wait_q.writers, timeout); + (void)_pend_current_thread(key, &pipe->wait_q.writers, timeout); } else { k_sched_unlock(); } @@ -707,7 +707,7 @@ int _impl_k_pipe_get(struct k_pipe *pipe, void *data, size_t bytes_to_read, _current->base.swap_data = &pipe_desc; key = irq_lock(); _sched_unlock_no_reschedule(); - _pend_current_thread(key, &pipe->wait_q.readers, timeout); + (void)_pend_current_thread(key, &pipe->wait_q.readers, timeout); } else { k_sched_unlock(); } diff --git a/kernel/timer.c b/kernel/timer.c index 037599755a0..41402f23f9f 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -206,7 +206,7 @@ u32_t _impl_k_timer_status_sync(struct k_timer *timer) if (result == 0) { if (timer->timeout.delta_ticks_from_prev != _INACTIVE) { /* wait for timer to expire or stop */ - _pend_current_thread(key, &timer->wait_q, K_FOREVER); + (void)_pend_current_thread(key, &timer->wait_q, K_FOREVER); /* get updated timer status */ key = irq_lock();