power: fix error handling on setting governor
authorDavid Hunt <david.hunt@intel.com>
Tue, 8 Jan 2019 14:59:26 +0000 (14:59 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 15 Jan 2019 01:40:40 +0000 (02:40 +0100)
commitde394915dfa12628fd55680dadeda521e53ef948
tree68a2ffc54979c7121212ad9ce3344b1a34a87d36
parent423aa5e130baa4570bbb8b2035b7af292dcc1daf
power: fix error handling on setting governor

In the power_set_governor_*() functions, we using fputs() on /sys
filesystem. However, we also need to call fflush() to ensure that
the write completes successfully. Otherwise the attempt to set the
power governor fails and the function returns as if it has
succeeded. This patch adds an fflush to ensure that the
write succeeds, otherwise returns an error.

Fixes: e6c6dc0f96c8 ("power: add p-state driver compatibility")

Signed-off-by: David Hunt <david.hunt@intel.com>
lib/librte_power/power_acpi_cpufreq.c
lib/librte_power/power_pstate_cpufreq.c