[dpdk-dev] [PATCH] power: fix coverity issue
Hunt, David
david.hunt at intel.com
Mon Apr 8 17:32:40 CEST 2019
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 <liang.j.ma at intel.com>
> ---
> 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.
More information about the dev
mailing list