Skip to content

Commit

Permalink
Switch from deprecated bpf_program__title() API to
Browse files Browse the repository at this point in the history
bpf_program__section_name(). Also drop unnecessary error checks because
neither bpf_program__title() nor bpf_program__section_name() can fail or
return NULL.

Fixes: 5210958 ("libbpf: Deprecate notion of BPF program "title" in favor of "section name"")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 tools/perf/util/bpf-loader.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
  • Loading branch information
anakryiko authored and kernel-patches-bot committed Sep 9, 2020
1 parent 4004398 commit 4b8ccb5
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions tools/perf/util/bpf-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,19 +328,14 @@ config_bpf_program(struct bpf_program *prog)
probe_conf.no_inlines = false;
probe_conf.force_add = false;

config_str = bpf_program__title(prog, false);
if (IS_ERR(config_str)) {
pr_debug("bpf: unable to get title for program\n");
return PTR_ERR(config_str);
}

priv = calloc(sizeof(*priv), 1);
if (!priv) {
pr_debug("bpf: failed to alloc priv\n");
return -ENOMEM;
}
pev = &priv->pev;

config_str = bpf_program__section_name(prog);
pr_debug("bpf: config program '%s'\n", config_str);
err = parse_prog_config(config_str, &main_str, &is_tp, pev);
if (err)
Expand Down Expand Up @@ -454,10 +449,7 @@ preproc_gen_prologue(struct bpf_program *prog, int n,
if (err) {
const char *title;

title = bpf_program__title(prog, false);
if (!title)
title = "[unknown]";

title = bpf_program__section_name(prog);
pr_debug("Failed to generate prologue for program %s\n",
title);
return err;
Expand Down

0 comments on commit 4b8ccb5

Please sign in to comment.