[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bbf9c0b4-c048-3adf-5282-2355aa648acf@huawei.com>
Date: Tue, 21 Dec 2021 09:10:37 +0000
From: John Garry <john.garry@...wei.com>
To: Jiri Olsa <jolsa@...hat.com>
CC: <peterz@...radead.org>, <mingo@...hat.com>, <acme@...nel.org>,
<mark.rutland@....com>, <alexander.shishkin@...ux.intel.com>,
<namhyung@...nel.org>, <irogers@...gle.com>,
<kan.liang@...ux.intel.com>, <linux-perf-users@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] perf pmu: Fix event list for uncore PMUs
On 21/12/2021 07:58, Jiri Olsa wrote:
>> + /* Different names -> never duplicates */
>> + if (strcmp(alias_a->name, alias_b->name))
>> + return false;
>> + if (!alias_a->pmu)
>> + return true;
>> + if (!alias_b->pmu)
>> + return true;
> nit could be:
>
> if (!alias_a->pmu || !alias_b->pmu)
> return true;
>
> would be great to have more comments explaining the check
>
This is just a sanity check that both strings are non-NULL as we do a
strcmp() next. So would this be better:
if (!alias_a->pmu || !alias_b->pmu || !strcmp(alias_a->pmu, alias_b->pmu))
return true
?
It will spill a line.
Thanks,
John
> thanks,
> jirka
>
>> + if (!strcmp(alias_a->pmu, alias_b->pmu))
>> + return true;
>> + /* uncore PMUs */
Powered by blists - more mailing lists