From: "yukuai (C)" <yukuai3@huawei.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
Song Liu <songliubraving@fb.com>
Cc: <peterz@infradead.org>, <mingo@redhat.com>, <ast@kernel.org>,
<daniel@iogearbox.net>, <andrii@kernel.org>,
<linux-perf-users@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
<bpf@vger.kernel.org>, <yi.zhang@huawei.com>
Subject: Re: [PATCH] perf stat: Fix error return code in bperf__load()
Date: Wed, 2 Jun 2021 09:05:00 +0800 [thread overview]
Message-ID: <360aa666-2a78-d2f5-9547-6ebecd57bcb4@huawei.com> (raw)
In-Reply-To: <YLY8aKsMvBG+DB1W@kernel.org>
On 2021/06/01 21:55, Arnaldo Carvalho de Melo wrote:
> Em Tue, Jun 01, 2021 at 10:52:42AM -0300, Arnaldo Carvalho de Melo escreveu:
>> Em Mon, May 17, 2021 at 04:12:54PM +0800, Yu Kuai escreveu:
>>> Fix to return a negative error code from the error handling
>>> case instead of 0, as done elsewhere in this function.
>>>
>>> Reported-by: Hulk Robot <hulkci@huawei.com>
>>> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
>>
>> Applied, but I had to add Song to the CC list and also add this line:
>>
>> Fixes: 7fac83aaf2eecc9e ("perf stat: Introduce 'bperf' to share hardware PMCs with BPF")
>>
>> So that the stable@kernel.org folks can get this auto-collected.
>>
>> Perhaps you guys can make Hulk do that as well? :-)
>>
>> Thanks,
>
> Something else to teach Hulk:
>
> util/bpf_counter.c: In function ‘bperf__load’:
> util/bpf_counter.c:523:9: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
> 523 | if (evsel->bperf_leader_link_fd < 0 &&
> | ^~
> util/bpf_counter.c:526:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
> 526 | goto out;
> | ^~~~
> cc1: all warnings being treated as errors
>
> I'm adding the missing {} for the now multiline if block.
Sorry for the mistake, and similar errors will be checked in the future.
Thanks
Yu Kuai
>
> - Arnaldo
>>
>>> ---
>>> tools/perf/util/bpf_counter.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c
>>> index ddb52f748c8e..843b20aa6688 100644
>>> --- a/tools/perf/util/bpf_counter.c
>>> +++ b/tools/perf/util/bpf_counter.c
>>> @@ -522,6 +522,7 @@ static int bperf__load(struct evsel *evsel, struct target *target)
>>> evsel->bperf_leader_link_fd = bpf_link_get_fd_by_id(entry.link_id);
>>> if (evsel->bperf_leader_link_fd < 0 &&
>>> bperf_reload_leader_program(evsel, attr_map_fd, &entry))
>>> + err = -1;
>>> goto out;
>>>
>>> /*
>>> @@ -550,6 +551,7 @@ static int bperf__load(struct evsel *evsel, struct target *target)
>>> /* Step 2: load the follower skeleton */
>>> evsel->follower_skel = bperf_follower_bpf__open();
>>> if (!evsel->follower_skel) {
>>> + err = -1;
>>> pr_err("Failed to open follower skeleton\n");
>>> goto out;
>>> }
>>> --
>>> 2.25.4
>>>
>>
>> --
>>
>> - Arnaldo
>
prev parent reply other threads:[~2021-06-02 1:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-17 8:12 [PATCH] perf stat: Fix error return code in bperf__load() Yu Kuai
2021-05-29 9:10 ` yukuai (C)
2021-06-01 13:52 ` Arnaldo Carvalho de Melo
2021-06-01 13:55 ` Arnaldo Carvalho de Melo
2021-06-02 1:05 ` yukuai (C) [this message]
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=360aa666-2a78-d2f5-9547-6ebecd57bcb4@huawei.com \
--to=yukuai3@huawei.com \
--cc=acme@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=songliubraving@fb.com \
--cc=yi.zhang@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox