Skip to content

Commit 95993dc

Browse files
Yonghong SongMartin KaFai Lau
authored andcommitted
bpf: Use ERR_CAST instead of ERR_PTR(PTR_ERR(...))
Intel linux test robot reported a warning that ERR_CAST can be used for error pointer casting instead of more-complicated/rarely-used ERR_PTR(PTR_ERR(...)) style. There is no functionality change, but still let us replace two such instances as it improves consistency and readability. Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Yonghong Song <[email protected]> Signed-off-by: Martin KaFai Lau <[email protected]> Acked-by: Eduard Zingerman <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 42be23e commit 95993dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/bpf/cgroup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,11 +707,11 @@ static struct bpf_prog_list *get_prog_list(struct hlist_head *progs, struct bpf_
707707
if (is_link) {
708708
anchor_link = bpf_get_anchor_link(flags, id_or_fd);
709709
if (IS_ERR(anchor_link))
710-
return ERR_PTR(PTR_ERR(anchor_link));
710+
return ERR_CAST(anchor_link);
711711
} else if (is_id || id_or_fd) {
712712
anchor_prog = bpf_get_anchor_prog(flags, id_or_fd);
713713
if (IS_ERR(anchor_prog))
714-
return ERR_PTR(PTR_ERR(anchor_prog));
714+
return ERR_CAST(anchor_prog);
715715
}
716716

717717
if (!anchor_prog && !anchor_link) {

0 commit comments

Comments
 (0)