[PATCH net] net: add inline annotation to fix the build warning

From: Moon Yeounsu
Date: Thu Sep 19 2024 - 10:23:06 EST


This patch fixes two sparse warnings (`make C=1`):
net/ipv6/icmp.c:103:20: warning: context imbalance in 'icmpv6_xmit_lock' - wrong count at exit
net/ipv6/icmp.c:119:13: warning: context imbalance in 'icmpv6_xmit_unlock' - unexpected unlock

Since `icmp6_xmit_lock()` and `icmp6_xmit_unlock()` are designed as they
are named, entering/returning the function without lock/unlock doesn't
matter.

Signed-off-by: Moon Yeounsu <yyyynoom@xxxxxxxxx>
---
net/ipv6/icmp.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 071b0bc1179d..d8cc3d63c942 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -101,6 +101,7 @@ static const struct inet6_protocol icmpv6_protocol = {

/* Called with BH disabled */
static struct sock *icmpv6_xmit_lock(struct net *net)
+ __acquires(&sk->sk_lock.slock)
{
struct sock *sk;

@@ -117,6 +118,7 @@ static struct sock *icmpv6_xmit_lock(struct net *net)
}

static void icmpv6_xmit_unlock(struct sock *sk)
+ __releases(&sk->sk_lock.slock)
{
sock_net_set(sk, &init_net);
spin_unlock(&sk->sk_lock.slock);
--
2.46.1