Skip to content

Commit

Permalink
libbpf: Simplify the return expression of build_map_pin_path()
Browse files Browse the repository at this point in the history
Simplify the return expression.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20200819025324.14680-1-vulab@iscas.ac.cn
  • Loading branch information
Xu Wang authored and Daniel Borkmann committed Aug 20, 2020
1 parent c1447ef commit 6e9cab2
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions tools/lib/bpf/libbpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1943,7 +1943,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";
Expand All @@ -1954,11 +1954,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);
}


Expand Down

0 comments on commit 6e9cab2

Please sign in to comment.