include: zephyr: Fix build error in spinlock.h

In function z_spin_onexit, when CONFIG_FORCE_NO_ASSERT=y
and CONFIG_SPIN_VALIDATE=y the function parameter becomes unused.
This generates a build error (unused parameter 'k').

Add __maybe_unused to fix this error.

Signed-off-by: Prashanth S <slpp95prashanth@yahoo.com>
This commit is contained in:
Prashanth S 2023-07-14 08:52:28 +05:30 committed by Fabio Baltieri
parent 29d0cef49f
commit 76663444c1

View file

@ -278,7 +278,7 @@ static ALWAYS_INLINE void k_spin_release(struct k_spinlock *l)
}
#if defined(CONFIG_SPIN_VALIDATE) && defined(__GNUC__)
static ALWAYS_INLINE void z_spin_onexit(k_spinlock_key_t *k)
static ALWAYS_INLINE void z_spin_onexit(__maybe_unused k_spinlock_key_t *k)
{
__ASSERT(k->key, "K_SPINLOCK exited with goto, break or return, "
"use K_SPINLOCK_BREAK instead.");