mptcp: use lockdep_assert_held_once() instead of open-coding it
authorPaolo Abeni <pabeni@redhat.com>
Fri, 24 Sep 2021 21:12:36 +0000 (14:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 25 Sep 2021 10:36:51 +0000 (11:36 +0100)
We have a few more places where the mptcp code duplicates
lockdep_assert_held_once(). Let's use the existing macro and
avoid a bunch of compiler's conditional.

Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mptcp/protocol.c

index 3d1757b8ef696aa5006dfab7d1cff7fbb7966b3b..87ee409d68ab0d586b74a24979e9fa9298e88e48 100644 (file)
@@ -956,9 +956,7 @@ static void __mptcp_update_wmem(struct sock *sk)
 {
        struct mptcp_sock *msk = mptcp_sk(sk);
 
-#ifdef CONFIG_LOCKDEP
-       WARN_ON_ONCE(!lockdep_is_held(&sk->sk_lock.slock));
-#endif
+       lockdep_assert_held_once(&sk->sk_lock.slock);
 
        if (!msk->wmem_reserved)
                return;
@@ -1117,9 +1115,8 @@ out:
 
 static void __mptcp_clean_una_wakeup(struct sock *sk)
 {
-#ifdef CONFIG_LOCKDEP
-       WARN_ON_ONCE(!lockdep_is_held(&sk->sk_lock.slock));
-#endif
+       lockdep_assert_held_once(&sk->sk_lock.slock);
+
        __mptcp_clean_una(sk);
        mptcp_write_space(sk);
 }