kernel: stack: fix stack_push spinlock and return

The z_impl_k_stack_push() has a spinlock that is set after
stack member access, which could cause race conditions and
used multiple return statements. This commit
- moves the lock before the CHECKIF
- implements goto for flow of lock, reschedule, and unlock
- uses ret for single return at the end

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
1 file changed