mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] libbpf: fix warning PTR_ERR_OR_ZERO can be used
@ 2019-05-25  9:02 Hariprasad Kelam
  2019-05-25 19:33 ` Yonghong Song
  2019-05-28  9:26 ` Daniel Borkmann
  0 siblings, 2 replies; 3+ messages in thread
From: Hariprasad Kelam @ 2019-05-25  9:02 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, David S. Miller, Jakub Kicinski,
	Jesper Dangaard Brouer, John Fastabend, netdev, bpf,
	linux-kernel, xdp-newbies

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>
---
 tools/lib/bpf/libbpf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 197b574..33c25b6 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -3458,9 +3458,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,
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-28  9:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-25  9:02 [PATCH] libbpf: fix warning PTR_ERR_OR_ZERO can be used Hariprasad Kelam
2019-05-25 19:33 ` Yonghong Song
2019-05-28  9:26 ` Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome