perf bpf-filter: Return -1 directly when pfi allocation fails
Subsystems (2)
PATCH 1/1 perf bpf-filter: Return -1 directly when pfi allocation fails
From: Hao Ge <[email protected]>
Directly return -1 when pfi allocation fails,
instead of performing other operations on pfi.
--- tools/perf/util/bpf-filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/bpf-filter.c +1 -1
@@ -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 -1 ; } pfi->evsel = evsel;
Signature · 1 line
2.25.1
Arnaldo Carvalho de Melo
maintainerQuoted 3 lines · Hao Ge
From: Hao Ge <[email protected]>
Directly return -1 when pfi allocation fails,
The convention for this function is to return -errno, so please resubmit returning -ENOMEM.
- Arnaldo
Quoted 23 lines
instead of performing other operations on pfi.
Fixes 0fe2b18ddc40 ("perf bpf-filter: Support multiple events properly")Signed-off-by Hao Ge <[email protected]>--- tools/perf/util/bpf-filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/bpf-filter.c +1
-1@@ -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 -1 ; } pfi->evsel = evsel;Signature · 1 line
2.25.1
PATCH v2 1/1 perf bpf-filter: Return -ENOMEM directly when pfi allocation fails
From: Hao Ge <[email protected]>
Directly return -ENOMEM when pfi allocation fails, instead of performing other operations on pfi.
---
v2: Replace -1 with -ENOMEM as per Arnaldo's reminder.
Update title and commit message due to code change
--- tools/perf/util/bpf-filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/bpf-filter.c +1 -1
@@ -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;
Signature · 1 line
2.25.1
Re: [PATCH v2] perf bpf-filter: Return -ENOMEM directly when pfi allocation fails
Quoted 7 lines · Hao Ge
From: Hao Ge <[email protected]>
Directly return
-ENOMEMwhen pfi allocation fails, instead of performing other operations on pfi.Fixes 0fe2b18ddc40 ("perf bpf-filter: Support multiple events properly")Signed-off-by Hao Ge <[email protected]>
Thanks,
Namhyung
Quoted 23 lines
---
v2: Replace -1 with-ENOMEMas per Arnaldo's reminder.
Update title and commit message due to code change--- tools/perf/util/bpf-filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/bpf-filter.c +1
-1@@ -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;Signature · 1 line
2.25.1
Re: [PATCH v2] perf bpf-filter: Return -ENOMEM directly when pfi allocation fails
In reply to Hao GeQuoted 4 lines · Hao Ge
Directly return
-ENOMEMwhen pfi allocation fails, instead of performing other operations on pfi.
Applied to perf-tools-next, thanks!
Best regards,
Namhyung