tests/kernel/fatal: Don't swap while locked
This test takes an interrupt lock and tries to call z_swap_unlocked()
while holding it. That's not legal (in the general case it means
you're breaking a caller's lock!), though in this particular case it
was safe because we'll never return to this.
Regardless, there is a natural z_swap_irqlock() that releases the lock
atomically. Use that.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
diff --git a/tests/kernel/fatal/exception/src/main.c b/tests/kernel/fatal/exception/src/main.c
index 3fb2b44..d897c4e 100644
--- a/tests/kernel/fatal/exception/src/main.c
+++ b/tests/kernel/fatal/exception/src/main.c
@@ -246,10 +246,9 @@
/* Test that stack overflow check due to swap works */
blow_up_stack();
TC_PRINT("swapping...\n");
- z_swap_unlocked();
+ z_swap_irqlock(key);
TC_ERROR("should never see this\n");
rv = TC_FAIL;
- irq_unlock(key);
}
void stack_hw_overflow(void *p1, void *p2, void *p3)