Skip to contentSkip to conversation

libbpf: Remove unnecessary type cast

PATCH Applied Yuntao Wang 2 participants 2 messages Apr 24, 2022 – Apr 25, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libbpf: Remove unnecessary type cast

The link variable is already of type 'struct bpf_link *', casting it to 'struct bpf_link *' is redundant, drop it.

---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/libbpf.c +1 -1
index 9a213aaaac8a..cc1a8fc47f72 100644
@@ -11270,7 +11270,7 @@ static struct bpf_link *bpf_program__attach_btf_id(const struct bpf_program *pro
 		return libbpf_err_ptr(pfd);
 	}
 	link->fd = pfd;
-	return (struct bpf_link *)link;
+	return link;
 }
 
 struct bpf_link *bpf_program__attach_trace(const struct bpf_program *prog)
Signature · 1 line
2.35.3
#1 lore raw
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:

Quoted 7 lines · On Sun, 24 Apr 2022 22:34:20 +0800 you wrote:

The link variable is already of type 'struct bpf_link *', casting it to 'struct bpf_link *' is redundant, drop it.

---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
- [bpf-next] libbpf: Remove unnecessary type cast

    https://git.kernel.org/bpf/bpf-next/c/003fed595c0f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html