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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7B23E95A6C for ; Sat, 7 Oct 2023 20:36:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344159AbjJGUfF (ORCPT ); Sat, 7 Oct 2023 16:35:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343782AbjJGUfD (ORCPT ); Sat, 7 Oct 2023 16:35:03 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EEAD93; Sat, 7 Oct 2023 13:35:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=P0XjgGcwROeVVGyQzp4eM0gt2uiSNUTYGxKdqCX9ND8=; b=hkNzELmrNfiMGUcaxH+u8YbfpY qnkF3Jy1w8uNeNbEmmnHdSF20DY/Tg6WDSFh7VuNTkDFmuxKPk1lUXh62Z3kYUCeVVdNU3cwDI1jd PB3be/MQLikguwYykHf0d0qQpzJ9nd9UXcKz5X5+JONUa4tG0OquU/vyKWGfjRQPhJ9GpfFwVhOjq ohVjIfGkMDhiP0m4eyG5Wm7E+iV6/F9JzCYzhdSQ8AXl68IlfRCXsfHk/OMuHyAOuIlwf0L8BSJNM 12XLPwMwoJPj4qTFcW/3XlqGHssDxFtELdeQ4kX/SWrhoIuUwYu//DBUBR/+++GdwBuZmNg05PVLY VVtkmQJw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qpE04-00DzC5-2C; Sat, 07 Oct 2023 20:34:16 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 66AA4300388; Sat, 7 Oct 2023 22:34:11 +0200 (CEST) Date: Sat, 7 Oct 2023 22:34:11 +0200 From: Peter Zijlstra To: Lucy Mielke Cc: mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, irogers@google.com, adrian.hunter@intel.com, tglx@linutronix.de, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf/x86/p4: Fix "Wunused-but-set-variable" warning Message-ID: <20231007203411.GA8085@noisy.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 07, 2023 at 08:55:19PM +0200, Lucy Mielke wrote: > This fixes a compiler warning when compiling an allyesconfig with W=1: > warning: variable ´high´ set but not used [-Wunused-but-set-variable] What compiler and what .config? > Signed-off-by: Lucy Mielke > --- > arch/x86/events/intel/p4.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/events/intel/p4.c b/arch/x86/events/intel/p4.c > index 35936188db01..69aaf7c0f340 100644 > --- a/arch/x86/events/intel/p4.c > +++ b/arch/x86/events/intel/p4.c > @@ -1366,7 +1366,7 @@ static __initconst const struct x86_pmu p4_pmu = { > > __init int p4_pmu_init(void) > { > - unsigned int low, high; > + unsigned int low, __maybe_unused high; > int i, reg; > > /* If we get stripped -- indexing fails */ Right after this we have: rdmsr(MSR_IA32_MISC_ENABLE, low, high); which should get high unconditionally used. If there's a problem then it's probably inside that rdmsr macro.