* [PATCH] tools lib bpf: Use PTR_ERR_OR_ZERO()
@ 2017-11-27 23:11 Vasyl Gomonovych
0 siblings, 0 replies; only message in thread
From: Vasyl Gomonovych @ 2017-11-27 23:11 UTC (permalink / raw)
To: acme, joe, wangnan0, ast, davem, john.fastabend; +Cc: gomonovych, linux-kernel
Fix ptr_ret.cocci warnings:
tools/lib/bpf/libbpf.c:1744:1-3: WARNING: PTR_ERR_OR_ZERO can be used
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
Generated by: scripts/coccinelle/api/ptr_ret.cocci
Signed-off-by: Vasyl Gomonovych <gomonovych@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 35f6dfcdc565..c0894ef65631 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1741,9 +1741,7 @@ struct bpf_map *
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,
--
1.9.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-11-27 23:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-27 23:11 [PATCH] tools lib bpf: Use PTR_ERR_OR_ZERO() Vasyl Gomonovych
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®