All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Hao Ge <hao.ge@linux.dev>
Cc: peterz@infradead.org, mingo@redhat.com, namhyung@kernel.org,
	mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
	jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com,
	kan.liang@linux.intel.com, linux-perf-users@vger.kernel.org,
	linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
	Hao Ge <gehao@kylinos.cn>
Subject: Re: [PATCH] perf bpf-filter: Return -1 directly when pfi allocation fails
Date: Tue, 12 Nov 2024 13:58:32 -0300	[thread overview]
Message-ID: <ZzOJOEpyAc92462-@x1> (raw)
In-Reply-To: <20241112022815.191201-1-hao.ge@linux.dev>

On Tue, Nov 12, 2024 at 10:28:15AM +0800, Hao Ge wrote:
> From: Hao Ge <gehao@kylinos.cn>
> 
> Directly return -1 when pfi allocation fails,

The convention for this function is to return -errno, so please resubmit
returning -ENOMEM.

- Arnaldo

> instead of performing other operations on pfi.
> 
> Fixes: 0fe2b18ddc40 ("perf bpf-filter: Support multiple events properly")
> Signed-off-by: Hao Ge <gehao@kylinos.cn>
> ---
>  tools/perf/util/bpf-filter.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/bpf-filter.c b/tools/perf/util/bpf-filter.c
> index e87b6789eb9e..34c8bf7e469e 100644
> --- a/tools/perf/util/bpf-filter.c
> +++ b/tools/perf/util/bpf-filter.c
> @@ -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;
> -- 
> 2.25.1

  reply	other threads:[~2024-11-12 16:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12  2:28 [PATCH] perf bpf-filter: Return -1 directly when pfi allocation fails Hao Ge
2024-11-12 16:58 ` Arnaldo Carvalho de Melo [this message]
2024-11-13  3:05   ` [PATCH v2] perf bpf-filter: Return -ENOMEM " Hao Ge
2024-11-19  0:08     ` Namhyung Kim
2024-11-22 22:17     ` Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZzOJOEpyAc92462-@x1 \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=gehao@kylinos.cn \
    --cc=hao.ge@linux.dev \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.