From: Hariprasad Kelam Date: Sat, 25 May 2019 09:02:57 +0000 (+0530) Subject: libbpf: fix warning that PTR_ERR_OR_ZERO can be used X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=d98363b510ce9938a19b07fe3c02357d8c65d52a;p=openwrt%2Fstaging%2Fblogic.git 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 Acked-by: Yonghong Song Signed-off-by: Daniel Borkmann --- 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,