Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4ADD0C433F5 for ; Tue, 21 Dec 2021 09:10:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236161AbhLUJKz (ORCPT ); Tue, 21 Dec 2021 04:10:55 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]:4310 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232169AbhLUJKx (ORCPT ); Tue, 21 Dec 2021 04:10:53 -0500 Received: from fraeml703-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4JJ9br3Mwgz67W51; Tue, 21 Dec 2021 17:08:24 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml703-chm.china.huawei.com (10.206.15.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.20; Tue, 21 Dec 2021 10:10:51 +0100 Received: from [10.195.32.222] (10.195.32.222) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Tue, 21 Dec 2021 09:10:50 +0000 Subject: Re: [PATCH] perf pmu: Fix event list for uncore PMUs To: Jiri Olsa CC: , , , , , , , , , References: <1639670017-74918-1-git-send-email-john.garry@huawei.com> From: John Garry Message-ID: Date: Tue, 21 Dec 2021 09:10:37 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.195.32.222] X-ClientProxiedBy: lhreml750-chm.china.huawei.com (10.201.108.200) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 */