core/nds32: to avoid race condition
core/nds32: to avoid race condition

After the program to line 628(original program), we have determined that
the local variable of waiter is 0 because a task is getting the mutex
lock then clearing waiter to 0(line 608). If another task enters mutex
lock at this time, mtx->waiters will be written to 1 and go to sleep
waiting, but the local variable of waiter is still 0. This will cause
latter task which cannot be woke up when previous task leaves the mutex
unlock.

BUG=none
BRANCH=none
TEST=create two tasks and respectively access mutex_lock and
mutex_unlock. There would not happen that latter task cannot
be woke up when previous task leaves the mutex unlock.

Change-Id: I566a14c1120716af8e9ac99e183a989274a4e72e
Signed-off-by: tim <38846f7070d5770410e9ef8b439c72e7b53a72c5@ite.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2438084
Reviewed-by: Jett Rink <9d4aef0593e6843318d99df31597fb6153b89787@chromium.org>

coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec