Skip to content

Commit

Permalink
coding guidelines: comply with MISRA C:2012 Rule 17.7
Browse files Browse the repository at this point in the history
- added explicit cast to void when returned value is expectedly ignored

Signed-off-by: Abramo Bagnara <abramo.bagnara@bugseng.com>
  • Loading branch information
Abramo-Bagnara authored and nashif committed Apr 22, 2022
1 parent 7b6cdcb commit f77c7bb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion arch/x86/core/x86_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ int arch_buffer_validate(const void *addr, size_t size, bool write)
int ret = 0;

/* addr/size arbitrary, fix this up into an aligned region */
k_mem_region_align((uintptr_t *)&virt, &aligned_size,
(void)k_mem_region_align((uintptr_t *)&virt, &aligned_size,
(uintptr_t)addr, size, CONFIG_MMU_PAGE_SIZE);

for (size_t offset = 0; offset < aligned_size;
Expand Down
4 changes: 2 additions & 2 deletions include/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ static ALWAYS_INLINE void k_spin_unlock(struct k_spinlock *l,
* a memory barrier when used like this, and we don't have a
* Zephyr framework for that.
*/
atomic_clear(&l->locked);
(void)atomic_clear(&l->locked);
#endif
arch_irq_unlock(key.key);
}
Expand All @@ -195,7 +195,7 @@ static ALWAYS_INLINE void k_spin_release(struct k_spinlock *l)
__ASSERT(z_spin_unlock_valid(l), "Not my spinlock %p", l);
#endif
#ifdef CONFIG_SMP
atomic_clear(&l->locked);
(void)atomic_clear(&l->locked);
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void z_smp_global_unlock(unsigned int key)
_current->base.global_lock_count--;

if (_current->base.global_lock_count == 0) {
atomic_clear(&global_lock);
(void)atomic_clear(&global_lock);
}
}

Expand All @@ -44,7 +44,7 @@ void z_smp_global_unlock(unsigned int key)
void z_smp_release_global_lock(struct k_thread *thread)
{
if (thread->base.global_lock_count == 0) {
atomic_clear(&global_lock);
(void)atomic_clear(&global_lock);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/os/sem.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int sys_sem_init(struct sys_sem *sem, unsigned int initial_count,
return -EINVAL;
}

atomic_set(&sem->futex.val, (int)initial_count);
(void)atomic_set(&sem->futex.val, (int)initial_count);
sem->limit = (int)limit;

return 0;
Expand Down
2 changes: 1 addition & 1 deletion scripts/gen_syscalls.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def wrapper_defs(func_name, func_type, args):
wrap += "\t\t" + "(void)%s;\n" % invoke
wrap += "\t\t" + "return (%s)ret64;\n" % func_type
elif func_type == "void":
wrap += "\t\t" + "%s;\n" % invoke
wrap += "\t\t" + "(void)%s;\n" % invoke
wrap += "\t\t" + "return;\n"
elif func_type == "bool":
wrap += "\t\t" + "return %s != 0U;\n" % (invoke)
Expand Down

0 comments on commit f77c7bb

Please sign in to comment.