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 AD8FDC4167B for ; Tue, 5 Dec 2023 14:22:12 +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=fBY1shR/aP4VO1GBU+ojrDLdX/5CsX+9XD07DyawHks=; b=oJyE448Ilc5NN5 mGWvEP6Odp8vEOncl+IjLhvbjyprVXEuaHHVj1PnFeYoujjcir4WHVvrsnpuXljJIMzZAIHI3UyDA sFwotNt0hIer3hfHxbjvlNRK69z9XpMM1RPg5q2tgd9kEXC/ealV+Z/ucN2RW4DF4+86PR6gQevou RLySCDRJue7zOHn9fvzSxdcSttzC1rv4sevFVlkG10Kxf6hnBrgRSBZswpJer49GRLESUlYqEYbN0 hl5LJfOvN2HurIsLUxnQKrpzUQSeP0BgOcn/QozU3G4+/Ri3oHDdglh32hYaEQYljTDCo7E76QoJi 45Hesf+Q5yediW0AYO3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAWIx-007aVN-2O; Tue, 05 Dec 2023 14:21:43 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAWIu-007aU8-1s for linux-arm-kernel@lists.infradead.org; Tue, 05 Dec 2023 14:21:42 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 4A396CE1729; Tue, 5 Dec 2023 14:21:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19F2FC433C7; Tue, 5 Dec 2023 14:21:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701786095; bh=i1tccxd+eeEBFdaia4vgRnGqbSydm2KGkprxYV81Cww=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=P/1sMhDuwCzF2R1U8l9QkQcrlKg/XwJGUkDdhtEecCh2K0ZEq1AGgUDPqcLH8Mm+I 4N4abTyCacNS/I/MevxRwM60PzEmr5Fu0U4OjRQ3FbMmEZb8PgTxNbVGwkDpfi1UQe WZ2CNHLdnF3CFF2WHBOhw9YtUPfMv9sNc+4z929tLNkVG9S6frWbW+AWOmKh4POWxm +8SZWYu3iRrD9G20XP0ylM+fhj74Feswty6fH1uh4y0UV2GTX5MrpM+EZdpmRISCFh FD0+0QBZa39GQUwrgCXxD+lzFLdTsU2pKgc0I1eZPKKJRkOhVV4BpoY55w5M47CUdd kGuBk/9ejUerA== Date: Tue, 5 Dec 2023 14:21:28 +0000 From: Will Deacon To: Dan Carpenter Cc: oe-kbuild@lists.linux.dev, Shuai Xue , ilkka@os.amperecomputing.com, kaishen@linux.alibaba.com, helgaas@kernel.org, yangyicong@huawei.com, Jonathan.Cameron@huawei.com, baolin.wang@linux.alibaba.com, robin.murphy@arm.com, lkp@intel.com, oe-kbuild-all@lists.linux.dev, chengyou@linux.alibaba.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, rdunlap@infradead.org, mark.rutland@arm.com, zhuo.song@linux.alibaba.com, renyu.zj@linux.alibaba.com Subject: Re: [PATCH v11 4/5] drivers/perf: add DesignWare PCIe PMU driver Message-ID: <20231205142128.GA18450@willie-the-truck> References: <20231121013400.18367-5-xueshuai@linux.alibaba.com> <2d52f588-f584-4c01-8f41-227815a54e41@suswa.mountain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2d52f588-f584-4c01-8f41-227815a54e41@suswa.mountain> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231205_062141_008465_C04FC455 X-CRM114-Status: GOOD ( 13.58 ) 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 Sat, Nov 25, 2023 at 10:06:39AM +0300, Dan Carpenter wrote: > Hi Shuai, > > kernel test robot noticed the following build warnings: > > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: https://github.com/intel-lab-lkp/linux/commits/Shuai-Xue/docs-perf-Add-description-for-Synopsys-DesignWare-PCIe-PMU-driver/20231121-093713 > base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next > patch link: https://lore.kernel.org/r/20231121013400.18367-5-xueshuai%40linux.alibaba.com > patch subject: [PATCH v11 4/5] drivers/perf: add DesignWare PCIe PMU driver > config: x86_64-randconfig-r071-20231123 (https://download.01.org/0day-ci/archive/20231124/202311241906.0ymlLjyo-lkp@intel.com/config) > compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07) > reproduce: (https://download.01.org/0day-ci/archive/20231124/202311241906.0ymlLjyo-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot > | Reported-by: Dan Carpenter > | Closes: https://lore.kernel.org/r/202311241906.0ymlLjyo-lkp@intel.com/ > > smatch warnings: > drivers/perf/dwc_pcie_pmu.c:352 dwc_pcie_pmu_event_update() error: uninitialized symbol 'now'. > > vim +/now +352 drivers/perf/dwc_pcie_pmu.c > > 3481798a4ec51d1 Shuai Xue 2023-11-21 338 static void dwc_pcie_pmu_event_update(struct perf_event *event) > 3481798a4ec51d1 Shuai Xue 2023-11-21 339 { > 3481798a4ec51d1 Shuai Xue 2023-11-21 340 struct hw_perf_event *hwc = &event->hw; > 3481798a4ec51d1 Shuai Xue 2023-11-21 341 enum dwc_pcie_event_type type = DWC_PCIE_EVENT_TYPE(event); > 3481798a4ec51d1 Shuai Xue 2023-11-21 342 u64 delta, prev, now; > 3481798a4ec51d1 Shuai Xue 2023-11-21 343 > 3481798a4ec51d1 Shuai Xue 2023-11-21 344 do { > 3481798a4ec51d1 Shuai Xue 2023-11-21 345 prev = local64_read(&hwc->prev_count); > 3481798a4ec51d1 Shuai Xue 2023-11-21 346 > 3481798a4ec51d1 Shuai Xue 2023-11-21 347 if (type == DWC_PCIE_LANE_EVENT) > 3481798a4ec51d1 Shuai Xue 2023-11-21 348 now = dwc_pcie_pmu_read_lane_event_counter(event); > 3481798a4ec51d1 Shuai Xue 2023-11-21 349 else if (type == DWC_PCIE_TIME_BASE_EVENT) > 3481798a4ec51d1 Shuai Xue 2023-11-21 350 now = dwc_pcie_pmu_read_time_based_counter(event); > > uninitialized on else path. > > 3481798a4ec51d1 Shuai Xue 2023-11-21 351 > 3481798a4ec51d1 Shuai Xue 2023-11-21 @352 } while (local64_cmpxchg(&hwc->prev_count, prev, now) != prev); Shuai, any chance you can address this please? I think the event validation logic means that the type is only ever one of the cases you handle, so you probably just want to either initialise 'now' to 0 or WARN and return early if the type is unknown. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel