From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 525C2C433EF for ; Mon, 9 May 2022 08:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AXQIrtSIXattUTbwfeuqttf1D+Qx17l6VDV+nQWDGXo=; b=qRDuLLdUtJOMRF f7x7rjEHwh8FrYpA/GCSz9OVwabdZM0yQCNoozV4gA3PkLXPKm8Zx/eipkC+9A1TTLBi1t6EfcZo+ vuaPly6CP6k3uR4Op6siBd+dxZ7xONNpyjZK+/2cQO/Gf94YR/2r9UfrMarlYLjH4lOQ7+W1Enx1j CSenczEtiDNexYvO7XDYYvd+4YkC4RXXEe3TVKjeL7RKubHZGy7tXhrNsvP5PDevDN2WOpJzLH0K8 x/WWHeOTexQgOy91VT9AxEYv57BlTmVvCarEFTQuYL9s/mtgx+20Ld5388kLouDrsWp3uAwMSKlcQ NQHjziG3ZHtmHVfVSaNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnz1Z-00DBgD-5d; Mon, 09 May 2022 08:45:49 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nnz1V-00DBcn-26 for linux-arm-kernel@lists.infradead.org; Mon, 09 May 2022 08:45:46 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 954951042; Mon, 9 May 2022 01:45:39 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.3.22]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 964263F66F; Mon, 9 May 2022 01:45:37 -0700 (PDT) Date: Mon, 9 May 2022 09:45:30 +0100 From: Mark Rutland To: Jason Wang Cc: will@kernel.org, catalin.marinas@arm.com, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: perf: no need to initialise statics to 0 Message-ID: References: <20220508022312.93905-1-wangborong@cdjrlc.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220508022312.93905-1-wangborong@cdjrlc.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220509_014545_179033_B6AE53B0 X-CRM114-Status: GOOD ( 17.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, May 08, 2022 at 10:23:12AM +0800, Jason Wang wrote: > Static variables do not need to be initialised to 0, because compiler > will initialise all uninitialised statics to 0. Thus, remove the > unneeded initializations. > > Signed-off-by: Jason Wang I would strongly prefer that we leave this as-is. There is no problem with explicitly initializing a static variable to 0, and it clearly aligns with the cmpxchg arguments below. Removing the initialization makes that *less* clear. Thanks, Mark. > --- > arch/arm64/kernel/perf_event.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c > index cb69ff1e6138..919fdcf8fce6 100644 > --- a/arch/arm64/kernel/perf_event.c > +++ b/arch/arm64/kernel/perf_event.c > @@ -1226,7 +1226,7 @@ static struct ctl_table armv8_pmu_sysctl_table[] = { > > static void armv8_pmu_register_sysctl_table(void) > { > - static u32 tbl_registered = 0; > + static u32 tbl_registered; > > if (!cmpxchg_relaxed(&tbl_registered, 0, 1)) > register_sysctl("kernel", armv8_pmu_sysctl_table); > -- > 2.35.1 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel