summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorHariprasad Kelam <hariprasad.kelam@gmail.com>2019-05-25 12:02:57 +0300
committerDaniel Borkmann <daniel@iogearbox.net>2019-05-28 11:56:05 +0300
commitd98363b510ce9938a19b07fe3c02357d8c65d52a (patch)
tree1ab56fb10df2079d4c151f294676e679cffa7533 /tools
parent92bd6820f2b11c2decdd92e1f9020e804dbc2ed1 (diff)
downloadlinux-d98363b510ce9938a19b07fe3c02357d8c65d52a.tar.xz
libbpf: fix warning that PTR_ERR_OR_ZERO can be used
Fix below warning reported by coccicheck: /tools/lib/bpf/libbpf.c:3461:1-3: WARNING: PTR_ERR_OR_ZERO can be used Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com> Acked-by: Yonghong Song <yhs@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/bpf/libbpf.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index ff149372b3c0..fd5905ac2ec3 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -3460,9 +3460,7 @@ bpf_object__find_map_by_offset(struct bpf_object *obj, size_t offset)
long libbpf_get_error(const void *ptr)
{
- if (IS_ERR(ptr))
- return PTR_ERR(ptr);
- return 0;
+ return PTR_ERR_OR_ZERO(ptr);
}
int bpf_prog_load(const char *file, enum bpf_prog_type type,