diff options
Diffstat (limited to 'kernel/locking/rtmutex_common.h')
-rw-r--r-- | kernel/locking/rtmutex_common.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/kernel/locking/rtmutex_common.h b/kernel/locking/rtmutex_common.h index 68686b3ec3c1..d1d62f942be2 100644 --- a/kernel/locking/rtmutex_common.h +++ b/kernel/locking/rtmutex_common.h | |||
@@ -52,12 +52,13 @@ static inline int rt_mutex_has_waiters(struct rt_mutex *lock) | |||
52 | static inline struct rt_mutex_waiter * | 52 | static inline struct rt_mutex_waiter * |
53 | rt_mutex_top_waiter(struct rt_mutex *lock) | 53 | rt_mutex_top_waiter(struct rt_mutex *lock) |
54 | { | 54 | { |
55 | struct rt_mutex_waiter *w; | 55 | struct rb_node *leftmost = rb_first_cached(&lock->waiters); |
56 | 56 | struct rt_mutex_waiter *w = NULL; | |
57 | w = rb_entry(lock->waiters.rb_leftmost, | ||
58 | struct rt_mutex_waiter, tree_entry); | ||
59 | BUG_ON(w->lock != lock); | ||
60 | 57 | ||
58 | if (leftmost) { | ||
59 | w = rb_entry(leftmost, struct rt_mutex_waiter, tree_entry); | ||
60 | BUG_ON(w->lock != lock); | ||
61 | } | ||
61 | return w; | 62 | return w; |
62 | } | 63 | } |
63 | 64 | ||