From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A3FDEA04B1; Mon, 23 Nov 2020 18:18:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 658B7C8C6; Mon, 23 Nov 2020 18:18:34 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 9F452A3; Mon, 23 Nov 2020 18:18:31 +0100 (CET) IronPort-SDR: xhLp1ZB9v5HeyaBaF9eGa0xF0YaWMaeUWVgdsP6Wb8dK8qeC+KBDOM/ZkAM9/F3fO5jUHiDHO8 rxWQ7M7jKTmQ== X-IronPort-AV: E=McAfee;i="6000,8403,9814"; a="171964896" X-IronPort-AV: E=Sophos;i="5.78,363,1599548400"; d="scan'208";a="171964896" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2020 09:18:30 -0800 IronPort-SDR: PJb7qxg11G6rck3HRFR9IpyPyQ2W/fP/OGo8opOGrL4ZStXtDFD0Hnes8UBhUywUUv0H/ADR7U STxeprXIfk/g== X-IronPort-AV: E=Sophos;i="5.78,363,1599548400"; d="scan'208";a="327268830" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.252.20.15]) ([10.252.20.15]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2020 09:18:28 -0800 To: "Xu, Rosen" , "Walsh, Conor" , "Zhang, Tianfei" , "Pei, Andy" Cc: "dev@dpdk.org" , "stable@dpdk.org" , "Chen, LingliX" References: <20201119150011.4005300-1-conor.walsh@intel.com> From: Ferruh Yigit Message-ID: <7c5d09fc-7f7b-7f28-723b-2b5066baa286@intel.com> Date: Mon, 23 Nov 2020 17:18:25 +0000 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] raw/ifpga/base: fix uninitialized variables gcc warning X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 11/20/2020 1:22 AM, Xu, Rosen wrote: > Hi, > > >> -----Original Message----- >> From: Walsh, Conor >> Sent: Thursday, November 19, 2020 23:00 >> To: Xu, Rosen ; Zhang, Tianfei >> ; Pei, Andy >> Cc: dev@dpdk.org; stable@dpdk.org; Chen, LingliX ; >> Walsh, Conor >> Subject: [PATCH] raw/ifpga/base: fix uninitialized variables gcc warning >> >> On Ubuntu 18.04 using gcc 7.5, gcc sees size and start as possibly being >> uninitialized. This patch initialises size and start to correct this warning. >> >> Exact warning: >> ../drivers/raw/ifpga/base/opae_intel_max10.c:488:22: warning: ‘size’ >> may be used uninitialized in this function [-Wmaybe-uninitialized] >> raw->regs[i].size = size; >> ../drivers/raw/ifpga/base/opae_intel_max10.c:484:25: warning: ‘start’ >> may be used uninitialized in this function [-Wmaybe-uninitialized] >> raw->regs[i].regoff = start; >> >> Fixes: 45f301724ba7 ("raw/ifpga/base: support sensor") >> >> Signed-off-by: Conor Walsh >> --- >> drivers/raw/ifpga/base/opae_intel_max10.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/raw/ifpga/base/opae_intel_max10.c >> b/drivers/raw/ifpga/base/opae_intel_max10.c >> index 1a526ea549..1c12a85195 100644 >> --- a/drivers/raw/ifpga/base/opae_intel_max10.c >> +++ b/drivers/raw/ifpga/base/opae_intel_max10.c >> @@ -418,7 +418,7 @@ max10_sensor_init(struct intel_max10_device *dev, >> int parent) >> int i, ret = 0, offset = 0; >> const fdt32_t *num; >> const char *ptr; >> - u64 start, size; >> + u64 start = 0, size = 0; >> struct raw_sensor_info *raw; >> struct opae_sensor_info *sensor; >> char *fdt_root = dev->fdt_root; >> -- >> 2.25.1 > > Reviewed-by: Rosen Xu > This also looks a compiler false positive, at least it would be good to highlight in the commit log that you are not fixing the code but false compiler warning. And since the code is not in the data path, I guess it is OK to add initialization to silence the compiler. But if the warnings doesn't break the build but just warnings, leaving them as it is also an option I think.