]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
locking/rt: Annotate unlock followed by lock for sparse.
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Mon, 12 Aug 2024 10:39:05 +0000 (12:39 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 24 Oct 2024 09:27:02 +0000 (11:27 +0200)
rt_mutex_slowlock_block() and rtlock_slowlock_locked() both unlock
lock::wait_lock and then lock it later. This is unusual and sparse
complains about it.

Add __releases() + __acquires() annotation to mark that it is expected.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240812104200.2239232-5-bigeasy@linutronix.de
kernel/locking/rtmutex.c

index ebebd0eec7f636088548a7ff43b9b6174a9c1cfb..d3b72c2f983f70f15f8fcae9300154589b53b273 100644 (file)
@@ -1601,6 +1601,7 @@ static int __sched rt_mutex_slowlock_block(struct rt_mutex_base *lock,
                                           unsigned int state,
                                           struct hrtimer_sleeper *timeout,
                                           struct rt_mutex_waiter *waiter)
+       __releases(&lock->wait_lock) __acquires(&lock->wait_lock)
 {
        struct rt_mutex *rtm = container_of(lock, struct rt_mutex, rtmutex);
        struct task_struct *owner;
@@ -1805,6 +1806,7 @@ static __always_inline int __rt_mutex_lock(struct rt_mutex_base *lock,
  * @lock:      The underlying RT mutex
  */
 static void __sched rtlock_slowlock_locked(struct rt_mutex_base *lock)
+       __releases(&lock->wait_lock) __acquires(&lock->wait_lock)
 {
        struct rt_mutex_waiter waiter;
        struct task_struct *owner;