diff mbox series

[PATCHv2,bpf-next] samples/bpf:remove unneeded variable

Message ID 20211209080051.421844-1-chi.minghao@zte.com.cn (mailing list archive)
State Accepted
Commit ac55b3f00c323cf09d59a191e14bcf39b691078c
Delegated to: BPF
Headers show
Series [PATCHv2,bpf-next] samples/bpf:remove unneeded variable | expand

Checks

Context Check Description
bpf/vmtest-bpf-next fail VM_Test
bpf/vmtest-bpf-next-PR fail PR summary
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 13 of 13 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

CGEL Dec. 9, 2021, 8 a.m. UTC
From: Minghao Chi <chi.minghao@zte.com.cn>

return value form 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>
---
 samples/bpf/xdp_redirect_cpu.bpf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Andrii Nakryiko Dec. 9, 2021, 5:27 p.m. UTC | #1
On Thu, Dec 9, 2021 at 12:01 AM <cgel.zte@gmail.com> wrote:
>
> From: Minghao Chi <chi.minghao@zte.com.cn>
>
> return value form 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>
> ---

Applied to bpf-next, thanks.

>  samples/bpf/xdp_redirect_cpu.bpf.c | 4 +---
>  1 file changed, 1 insertion(+), 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
> --
> 2.25.1
>
patchwork-bot+netdevbpf@kernel.org Dec. 9, 2021, 5:30 p.m. UTC | #2
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Thu,  9 Dec 2021 08:00:51 +0000 you wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> return value form 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>
> 
> [...]

Here is the summary with links:
  - [PATCHv2,bpf-next] samples/bpf:remove unneeded variable
    https://git.kernel.org/bpf/bpf-next/c/ac55b3f00c32

You are awesome, thank you!
diff mbox series

Patch

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