From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 2A8702BCE for ; Mon, 8 Apr 2019 17:32:43 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Apr 2019 08:32:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,325,1549958400"; d="scan'208";a="159269175" Received: from dhunt5-mobl2.ger.corp.intel.com (HELO [10.237.210.31]) ([10.237.210.31]) by fmsmga002.fm.intel.com with ESMTP; 08 Apr 2019 08:32:41 -0700 To: Liang Ma , dev@dpdk.org Cc: anatoly.burakov@intel.com References: <1554736884-12195-1-git-send-email-liang.j.ma@intel.com> From: "Hunt, David" Message-ID: Date: Mon, 8 Apr 2019 16:32:40 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <1554736884-12195-1-git-send-email-liang.j.ma@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH] power: fix coverity issue 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: , X-List-Received-Date: Mon, 08 Apr 2019 15:32:44 -0000 Hi Liang, On 8/4/2019 4:21 PM, Liang Ma wrote: > Coverity issue: 337668 > > Fixes: b60fd5f8b1ce8f0a2c ("power: add bit for high frequency cores") > > Signed-off-by: Liang Ma > --- > lib/librte_power/power_pstate_cpufreq.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/lib/librte_power/power_pstate_cpufreq.c b/lib/librte_power/power_pstate_cpufreq.c > index 336c13869..db2f7a0f4 100644 > --- a/lib/librte_power/power_pstate_cpufreq.c > +++ b/lib/librte_power/power_pstate_cpufreq.c > @@ -197,6 +197,9 @@ power_init_for_setting_freq(struct pstate_power_info *pi) > / BUS_FREQ; > } > > + if (f_base != NULL) > + fclose(f_base); > + > /* Add MSR read to detect turbo status */ > > if (power_rdmsr(PLATFORM_INFO, &max_non_turbo, pi->lcore_id) < 0) Rather than adding a new 'if' statement, you could just add the fclose() to the previous section, which checks for a similar condition. Maybe just after the FOPS_OR_NULL_GOTO() (line 189). Rgds, Dave. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id BB54EA0096 for ; Mon, 8 Apr 2019 17:32:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 380952C54; Mon, 8 Apr 2019 17:32:46 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 2A8702BCE for ; Mon, 8 Apr 2019 17:32:43 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Apr 2019 08:32:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,325,1549958400"; d="scan'208";a="159269175" Received: from dhunt5-mobl2.ger.corp.intel.com (HELO [10.237.210.31]) ([10.237.210.31]) by fmsmga002.fm.intel.com with ESMTP; 08 Apr 2019 08:32:41 -0700 To: Liang Ma , dev@dpdk.org Cc: anatoly.burakov@intel.com References: <1554736884-12195-1-git-send-email-liang.j.ma@intel.com> From: "Hunt, David" Message-ID: Date: Mon, 8 Apr 2019 16:32:40 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <1554736884-12195-1-git-send-email-liang.j.ma@intel.com> Content-Type: text/plain; charset="UTF-8"; format="flowed" Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH] power: fix coverity issue 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" Message-ID: <20190408153240.TThNXPrv8zAxVk0wf2ZNBnpmF2Yg1Cd_7-7Ma2u3Tro@z> Hi Liang, On 8/4/2019 4:21 PM, Liang Ma wrote: > Coverity issue: 337668 > > Fixes: b60fd5f8b1ce8f0a2c ("power: add bit for high frequency cores") > > Signed-off-by: Liang Ma > --- > lib/librte_power/power_pstate_cpufreq.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/lib/librte_power/power_pstate_cpufreq.c b/lib/librte_power/power_pstate_cpufreq.c > index 336c13869..db2f7a0f4 100644 > --- a/lib/librte_power/power_pstate_cpufreq.c > +++ b/lib/librte_power/power_pstate_cpufreq.c > @@ -197,6 +197,9 @@ power_init_for_setting_freq(struct pstate_power_info *pi) > / BUS_FREQ; > } > > + if (f_base != NULL) > + fclose(f_base); > + > /* Add MSR read to detect turbo status */ > > if (power_rdmsr(PLATFORM_INFO, &max_non_turbo, pi->lcore_id) < 0) Rather than adding a new 'if' statement, you could just add the fclose() to the previous section, which checks for a similar condition. Maybe just after the FOPS_OR_NULL_GOTO() (line 189). Rgds, Dave.