kernel: 5.4: import wireguard backport
[openwrt/openwrt.git] / target / linux / generic / backport-5.4 / 080-wireguard-0117-wireguard-avoid-double-unlikely-notation-when-using-.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Antonio Quartulli <a@unstable.cc>
3 Date: Mon, 22 Feb 2021 17:25:43 +0100
4 Subject: [PATCH] wireguard: avoid double unlikely() notation when using
5 IS_ERR()
6
7 commit 30ac4e2f54ec067b7b9ca0db27e75681581378d6 upstream.
8
9 The definition of IS_ERR() already applies the unlikely() notation
10 when checking the error status of the passed pointer. For this
11 reason there is no need to have the same notation outside of
12 IS_ERR() itself.
13
14 Clean up code by removing redundant notation.
15
16 Signed-off-by: Antonio Quartulli <a@unstable.cc>
17 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
18 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
19 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
20 ---
21 drivers/net/wireguard/device.c | 2 +-
22 drivers/net/wireguard/socket.c | 4 ++--
23 2 files changed, 3 insertions(+), 3 deletions(-)
24
25 --- a/drivers/net/wireguard/device.c
26 +++ b/drivers/net/wireguard/device.c
27 @@ -157,7 +157,7 @@ static netdev_tx_t wg_xmit(struct sk_buf
28 } else {
29 struct sk_buff *segs = skb_gso_segment(skb, 0);
30
31 - if (unlikely(IS_ERR(segs))) {
32 + if (IS_ERR(segs)) {
33 ret = PTR_ERR(segs);
34 goto err_peer;
35 }
36 --- a/drivers/net/wireguard/socket.c
37 +++ b/drivers/net/wireguard/socket.c
38 @@ -71,7 +71,7 @@ static int send4(struct wg_device *wg, s
39 ip_rt_put(rt);
40 rt = ip_route_output_flow(sock_net(sock), &fl, sock);
41 }
42 - if (unlikely(IS_ERR(rt))) {
43 + if (IS_ERR(rt)) {
44 ret = PTR_ERR(rt);
45 net_dbg_ratelimited("%s: No route to %pISpfsc, error %d\n",
46 wg->dev->name, &endpoint->addr, ret);
47 @@ -138,7 +138,7 @@ static int send6(struct wg_device *wg, s
48 }
49 dst = ipv6_stub->ipv6_dst_lookup_flow(sock_net(sock), sock, &fl,
50 NULL);
51 - if (unlikely(IS_ERR(dst))) {
52 + if (IS_ERR(dst)) {
53 ret = PTR_ERR(dst);
54 net_dbg_ratelimited("%s: No route to %pISpfsc, error %d\n",
55 wg->dev->name, &endpoint->addr, ret);