selftests/resctrl: Close perf value read fd on errors
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 17 Jul 2023 13:14:52 +0000 (16:14 +0300)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 25 Jul 2023 14:52:27 +0000 (08:52 -0600)
commit51a0c3b7f028169e40db930575dd01fe81c3e765
tree05f64f9ba0c0f5b0b7133b76cafd6f646f9bc053
parentf99e413eb54652e2436cc56d081176bc9a34cd8d
selftests/resctrl: Close perf value read fd on errors

Perf event fd (fd_lm) is not closed when run_fill_buf() returns error.

Close fd_lm only in cat_val() to make it easier to track it is always
closed.

Fixes: 790bf585b0ee ("selftests/resctrl: Add Cache Allocation Technology (CAT) selftest")
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tested-by: Babu Moger <babu.moger@amd.com>
Tested-by: Shaopeng Tan (Fujitsu) <tan.shaopeng@fujitsu.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/resctrl/cache.c