summaryrefslogtreecommitdiff
path: root/samples/bpf
diff options
context:
space:
mode:
authorMinghao Chi <chi.minghao@zte.com.cn>2021-12-09 08:00:51 +0000
committerAndrii Nakryiko <andrii@kernel.org>2021-12-09 09:21:45 -0800
commitac55b3f00c323cf09d59a191e14bcf39b691078c (patch)
treef8c5e046a3726f57c696a67258cb8b7964054414 /samples/bpf
parent73b6eae583f44e278e19489a411f9c1e22d530fc (diff)
samples/bpf: Remove unneeded variable
Return value directly instead of taking this in another redundant variable. Reported-by: Zeal Robot <zealci@zte.com.cm> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20211209080051.421844-1-chi.minghao@zte.com.cn
Diffstat (limited to 'samples/bpf')
-rw-r--r--samples/bpf/xdp_redirect_cpu.bpf.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/samples/bpf/xdp_redirect_cpu.bpf.c b/samples/bpf/xdp_redirect_cpu.bpf.c
index f10fe3cf25f6..25e3a405375f 100644
--- a/samples/bpf/xdp_redirect_cpu.bpf.c
+++ b/samples/bpf/xdp_redirect_cpu.bpf.c
@@ -100,7 +100,6 @@ u16 get_dest_port_ipv4_udp(struct xdp_md *ctx, u64 nh_off)
void *data = (void *)(long)ctx->data;
struct iphdr *iph = data + nh_off;
struct udphdr *udph;
- u16 dport;
if (iph + 1 > data_end)
return 0;
@@ -111,8 +110,7 @@ u16 get_dest_port_ipv4_udp(struct xdp_md *ctx, u64 nh_off)
if (udph + 1 > data_end)
return 0;
- dport = bpf_ntohs(udph->dest);
- return dport;
+ return bpf_ntohs(udph->dest);
}
static __always_inline