perf bpf-filter: Return -ENOMEM directly when pfi allocation fails

Directly return -ENOMEM when pfi allocation fails,
instead of performing other operations on pfi.

Fixes: 0fe2b18ddc ("perf bpf-filter: Support multiple events properly")
Signed-off-by: Hao Ge <gehao@kylinos.cn>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: hao.ge@linux.dev
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20241113030537.26732-1-hao.ge@linux.dev
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
Hao Ge 2024-11-13 11:05:37 +08:00 committed by Namhyung Kim
parent fc26637d70
commit bd077a53ad

View File

@ -375,7 +375,7 @@ static int create_idx_hash(struct evsel *evsel, struct perf_bpf_filter_entry *en
pfi = zalloc(sizeof(*pfi));
if (pfi == NULL) {
pr_err("Cannot save pinned filter index\n");
goto err;
return -ENOMEM;
}
pfi->evsel = evsel;