spinlock: spin_initialize should add memory barrier

reason:
spin_initialize is often used to release a lock,
and if we don't include a memory barrier,
it may lead to the lock being released prematurely.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2024-07-23 18:44:45 +08:00 committed by Xiang Xiao
parent 855060f353
commit 874c0b002c

View File

@ -510,7 +510,7 @@ static inline_function void spin_unlock(FAR volatile spinlock_t *lock)
/* void spin_initialize(FAR spinlock_t *lock, spinlock_t state); */
#define spin_initialize(l,s) do { *(l) = (s); } while (0)
#define spin_initialize(l,s) do { SP_DMB(); *(l) = (s); } while (0)
/****************************************************************************
* Name: spin_lock_irqsave_wo_note