rt-mutex: fix stale return value
Changes
1 files changed · +9 −2
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| kernel/rtmutex.c | modified | +9 | −2 | View file |
kernel/rtmutex.c
View filediff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index 12879f6..a273183 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -636,9 +636,16 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state,
* all over without going into schedule to try
* to get the lock now:
*/
- if (unlikely(!waiter.task))
+ if (unlikely(!waiter.task)) {
+ /*
+ * Reset the return value. We might
+ * have returned with -EDEADLK and the
+ * owner released the lock while we
+ * were walking the pi chain.
+ */
+ ret = 0;
continue;
-
+ }
if (unlikely(ret))
break;
}