2020-08-19 03:00:43

by Xu Wang

[permalink] [raw]
Subject: [PATCH bpf-next] libbpf: simplify the return expression of build_map_pin_path()

Simplify the return expression.

Signed-off-by: Xu Wang <[email protected]>
---
tools/lib/bpf/libbpf.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 5d20b2da4427..cd59e237ca96 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1924,7 +1924,7 @@ static bool get_map_field_int(const char *map_name, const struct btf *btf,
static int build_map_pin_path(struct bpf_map *map, const char *path)
{
char buf[PATH_MAX];
- int err, len;
+ int len;

if (!path)
path = "/sys/fs/bpf";
@@ -1935,11 +1935,7 @@ static int build_map_pin_path(struct bpf_map *map, const char *path)
else if (len >= PATH_MAX)
return -ENAMETOOLONG;

- err = bpf_map__set_pin_path(map, buf);
- if (err)
- return err;
-
- return 0;
+ return bpf_map__set_pin_path(map, buf);
}


--
2.17.1


2020-08-19 04:19:46

by Yonghong Song

[permalink] [raw]
Subject: Re: [PATCH bpf-next] libbpf: simplify the return expression of build_map_pin_path()



On 8/18/20 7:53 PM, Xu Wang wrote:
> Simplify the return expression.
>
> Signed-off-by: Xu Wang <[email protected]>

Acked-by: Yonghong Song <[email protected]>

2020-08-20 14:21:58

by Daniel Borkmann

[permalink] [raw]
Subject: Re: [PATCH bpf-next] libbpf: simplify the return expression of build_map_pin_path()

On 8/19/20 4:53 AM, Xu Wang wrote:
> Simplify the return expression.
>
> Signed-off-by: Xu Wang <[email protected]>

Applied, thanks!