Skip to content

Commit f77c7bb

Browse files
Abramo-Bagnaranashif
authored andcommitted
coding guidelines: comply with MISRA C:2012 Rule 17.7
- added explicit cast to void when returned value is expectedly ignored Signed-off-by: Abramo Bagnara <abramo.bagnara@bugseng.com>
1 parent 7b6cdcb commit f77c7bb

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

arch/x86/core/x86_mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,7 @@ int arch_buffer_validate(const void *addr, size_t size, bool write)
13171317
int ret = 0;
13181318

13191319
/* addr/size arbitrary, fix this up into an aligned region */
1320-
k_mem_region_align((uintptr_t *)&virt, &aligned_size,
1320+
(void)k_mem_region_align((uintptr_t *)&virt, &aligned_size,
13211321
(uintptr_t)addr, size, CONFIG_MMU_PAGE_SIZE);
13221322

13231323
for (size_t offset = 0; offset < aligned_size;

include/spinlock.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ static ALWAYS_INLINE void k_spin_unlock(struct k_spinlock *l,
180180
* a memory barrier when used like this, and we don't have a
181181
* Zephyr framework for that.
182182
*/
183-
atomic_clear(&l->locked);
183+
(void)atomic_clear(&l->locked);
184184
#endif
185185
arch_irq_unlock(key.key);
186186
}
@@ -195,7 +195,7 @@ static ALWAYS_INLINE void k_spin_release(struct k_spinlock *l)
195195
__ASSERT(z_spin_unlock_valid(l), "Not my spinlock %p", l);
196196
#endif
197197
#ifdef CONFIG_SMP
198-
atomic_clear(&l->locked);
198+
(void)atomic_clear(&l->locked);
199199
#endif
200200
}
201201

kernel/smp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void z_smp_global_unlock(unsigned int key)
3333
_current->base.global_lock_count--;
3434

3535
if (_current->base.global_lock_count == 0) {
36-
atomic_clear(&global_lock);
36+
(void)atomic_clear(&global_lock);
3737
}
3838
}
3939

@@ -44,7 +44,7 @@ void z_smp_global_unlock(unsigned int key)
4444
void z_smp_release_global_lock(struct k_thread *thread)
4545
{
4646
if (thread->base.global_lock_count == 0) {
47-
atomic_clear(&global_lock);
47+
(void)atomic_clear(&global_lock);
4848
}
4949
}
5050

lib/os/sem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ int sys_sem_init(struct sys_sem *sem, unsigned int initial_count,
5252
return -EINVAL;
5353
}
5454

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

5858
return 0;

scripts/gen_syscalls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def wrapper_defs(func_name, func_type, args):
210210
wrap += "\t\t" + "(void)%s;\n" % invoke
211211
wrap += "\t\t" + "return (%s)ret64;\n" % func_type
212212
elif func_type == "void":
213-
wrap += "\t\t" + "%s;\n" % invoke
213+
wrap += "\t\t" + "(void)%s;\n" % invoke
214214
wrap += "\t\t" + "return;\n"
215215
elif func_type == "bool":
216216
wrap += "\t\t" + "return %s != 0U;\n" % (invoke)

0 commit comments

Comments
 (0)