From patchwork Wed Aug 1 21:45:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 10553059 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 028F515E2 for ; Wed, 1 Aug 2018 21:46:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E44F42B88B for ; Wed, 1 Aug 2018 21:46:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8AEF2B895; Wed, 1 Aug 2018 21:46:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B24C12B88B for ; Wed, 1 Aug 2018 21:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=BpLsVHLsUgWpDsPfZJzrMSG03x6x9rdgHWZHaWMQZoY=; b=FeC XV8iu6lnJHAtgwR2rQPPfwR2udzySCMC9YR84jW9vjedE4GC89ZHKPJ7wEJE6yOdN5kGb/hswWr+U gOYcSLNLU1AtWBAl4TxoCQRPr11TWr5xOx+p5y5yqm4V6sPWnNCNGYfKK5RxG8PPfWmjAwyz68Kns y8iR0ADcjQtp8ZakmBVe2jW7CeEAPvZbuRtsQtnlfdOl45R/1B1+YzGNh83R7HE0KS8FOoiV4ihB+ KpFGH2QERI9EEgdjyqmHb/F4S6sGat/n/NeNo9PZkWqCt0K7iaXCFkrjKKUu+lu68jChC3Jll2qN9 bOF7tryaGtyfsoWPWbMj1kA+4uMNS/Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkywm-0002vJ-KT; Wed, 01 Aug 2018 21:46:20 +0000 Received: from gate2.alliedtelesis.co.nz ([202.36.163.20]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkywi-0002ta-Ln for linux-arm-kernel@lists.infradead.org; Wed, 01 Aug 2018 21:46:19 +0000 Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id 3DCD3806AC; Thu, 2 Aug 2018 09:45:35 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail; t=1533159935; bh=nRgQHLbphVGaTp42weGTtbcAsKX3+i7oUtLtPlH6uIE=; h=From:To:Cc:Subject:Date; b=w31nIj0aiwtQHANYhvL8uo5ml8H2DsH8BtJ1Dy5ThU3Nd55OFd7WdAucQS24UTsU0 qQvDDR1R/bEhyOlbbXtbnBgek7x/4ZBgO0ZCdrZznx0avj43inWcETtTe8jcPtbTIl 4GbJd6jmclMleCDoavxH5jaCAAqb2+idPoyyAig4= Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7, 5, 8, 10121) id ; Thu, 02 Aug 2018 09:45:33 +1200 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by smtp (Postfix) with ESMTP id 3D64813EEED; Thu, 2 Aug 2018 09:45:36 +1200 (NZST) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 7D97C1E01D1; Thu, 2 Aug 2018 09:45:34 +1200 (NZST) From: Chris Packham To: mark.rutland@arm.com, will.deacon@arm.com Subject: [PATCH] arm_pmu: fix compiler warning in arm_pmu_device_probe Date: Thu, 2 Aug 2018 09:45:26 +1200 Message-Id: <20180801214526.24599-1-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.18.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180801_144617_172923_274447C4 X-CRM114-Status: GOOD ( 13.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chris Packham , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP GCC warns arm_pmu_platform.c:234:5: error: 'err' may be used uninitialized in this function [-Werror=maybe-uninitialized] This is because we rely on the for_each_cpu loop in armpmu_request_irqs to initialise err. The warning is a little bogus because we know if there were 0 CPUs this code would not be running. Initialise err to 0 to avoid the warning. Signed-off-by: Chris Packham --- This has been reported before in https://lkml.org/lkml/2018/3/5/508 I'm not sure if it was dismmissed as "meh, gcc is wrong" or if it was just wainting for someone with some round tuits. drivers/perf/arm_pmu_platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/perf/arm_pmu_platform.c b/drivers/perf/arm_pmu_platform.c index 971ff336494a..96075cecb0ae 100644 --- a/drivers/perf/arm_pmu_platform.c +++ b/drivers/perf/arm_pmu_platform.c @@ -160,7 +160,7 @@ static int pmu_parse_irqs(struct arm_pmu *pmu) static int armpmu_request_irqs(struct arm_pmu *armpmu) { struct pmu_hw_events __percpu *hw_events = armpmu->hw_events; - int cpu, err; + int cpu, err = 0; for_each_cpu(cpu, &armpmu->supported_cpus) { int irq = per_cpu(hw_events->irq, cpu);