When the power_intel_uncore_autotest unit test is run as an unprivileged user which cannot init the power library, it crashes the unit test binary due to calling "rte_power_uncore_exit" after the first test case (initialization) fails. This crash is due to trying to write to NULL file handles. Fix the crash by checking each file handle is non-null before writing to it and closing it. Fixes: 60b8a661a957 ("power: add Intel uncore frequency control") Cc: stable@dpdk.org Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/power/intel_uncore/intel_uncore.c | 35 ++++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-)
Acked-by: Kevin Laatz <kevin.laatz@intel.com>