Commit 77121450 authored by Hao Ge's avatar Hao Ge Committed by Sean Christopherson

KVM: selftests: Close opened file descriptor in stable_tsc_check_supported()

Close the "current_clocksource" file descriptor before returning or exiting
from stable_tsc_check_supported() in vmx_nested_tsc_scaling_test.
Signed-off-by: default avatarHao Ge <gehao@kylinos.cn>
Reviewed-by: default avatarVipin Sharma <vipinsh@google.com>
Link: https://lore.kernel.org/r/20230405101350.259000-1-gehao@kylinos.cnSigned-off-by: default avatarSean Christopherson <seanjc@google.com>
parent d563164e
...@@ -126,12 +126,16 @@ static void stable_tsc_check_supported(void) ...@@ -126,12 +126,16 @@ static void stable_tsc_check_supported(void)
goto skip_test; goto skip_test;
if (fgets(buf, sizeof(buf), fp) == NULL) if (fgets(buf, sizeof(buf), fp) == NULL)
goto skip_test; goto close_fp;
if (strncmp(buf, "tsc", sizeof(buf))) if (strncmp(buf, "tsc", sizeof(buf)))
goto skip_test; goto close_fp;
fclose(fp);
return; return;
close_fp:
fclose(fp);
skip_test: skip_test:
print_skip("Kernel does not use TSC clocksource - assuming that host TSC is not stable"); print_skip("Kernel does not use TSC clocksource - assuming that host TSC is not stable");
exit(KSFT_SKIP); exit(KSFT_SKIP);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment