lkml.org 
[lkml]   [2018]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] lib/bpf/libbpf: Simplify the code by using PTR_ERR_OR_ZERO
Date
Use PTR_ERR_OR_ZERO is better than the open code.

Signed-off-by: zhong jiang <zhongjiang@huawei.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 40211b5..9b61468 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -2271,9 +2271,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.7.12.4
\
 
 \ /
  Last update: 2018-07-31 18:43    [W:0.036 / U:1.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site