summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-11-01 20:01:59 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-11-01 20:01:59 +0100
commitd90c71a653c13bbbf1abe61f221a0e50aec4fe2e (patch)
treef41e88158be60e0b46e30fdf5e7da30acc562a74 /src
parent6466b384adee7f508a7cbfc17aca8b17dd61a732 (diff)
peer: kref is most likely to succeed
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src')
-rw-r--r--src/peer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/peer.c b/src/peer.c
index e1bd99c..6e6ccda 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -44,9 +44,9 @@ struct wireguard_peer *peer_create(struct wireguard_device *wg, const u8 public_
struct wireguard_peer *peer_get(struct wireguard_peer *peer)
{
RCU_LOCKDEP_WARN(!rcu_read_lock_held(), "Calling peer_get without holding the RCU read lock.");
- if (!peer)
+ if (unlikely(!peer))
return NULL;
- if (!kref_get_unless_zero(&peer->refcount))
+ if (unlikely(!kref_get_unless_zero(&peer->refcount)))
return NULL;
return peer;
}