From be834ffbd15ea9d73ba96fdbdcb1012add7e3bdf Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Fri, 3 Jun 2016 12:36:39 -0300 Subject: tools lib bpf: Make bpf_program__get_private() use IS_ERR() For consistency with bpf_map__priv() and elsewhere. Acked-by: Wang Nan Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Milian Wolff Cc: Namhyung Kim Link: http://lkml.kernel.org/n/tip-x17nk5mrazkf45z0l0ahlmo8@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/lib/bpf/libbpf.c | 5 ++--- tools/lib/bpf/libbpf.h | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'tools/lib/bpf') diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 0412182fb365..7eb7fb26e999 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -1230,10 +1230,9 @@ int bpf_program__set_private(struct bpf_program *prog, return 0; } -int bpf_program__get_private(struct bpf_program *prog, void **ppriv) +void *bpf_program__priv(struct bpf_program *prog) { - *ppriv = prog->priv; - return 0; + return prog ? prog->priv : ERR_PTR(-EINVAL); } const char *bpf_program__title(struct bpf_program *prog, bool needs_copy) diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h index ea65775e8302..372cecbde207 100644 --- a/tools/lib/bpf/libbpf.h +++ b/tools/lib/bpf/libbpf.h @@ -81,8 +81,7 @@ typedef void (*bpf_program_clear_priv_t)(struct bpf_program *, int bpf_program__set_private(struct bpf_program *prog, void *priv, bpf_program_clear_priv_t clear_priv); -int bpf_program__get_private(struct bpf_program *prog, - void **ppriv); +void *bpf_program__priv(struct bpf_program *prog); const char *bpf_program__title(struct bpf_program *prog, bool needs_copy); -- cgit v1.2.3