Message ID | 20210307145502.2916364-13-fenghua.yu@intel.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Miscellaneous fixes for resctrl selftests | expand |
diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c index e3d18e113313..10b9292f33e5 100644 --- a/tools/testing/selftests/resctrl/resctrlfs.c +++ b/tools/testing/selftests/resctrl/resctrlfs.c @@ -570,6 +570,9 @@ bool check_resctrlfs_support(void) ksft_print_msg("%s kernel supports resctrl filesystem\n", ret ? "pass:" : "fail:"); + if (!ret) + return ret; + dp = opendir(RESCTRL_PATH); ksft_print_msg("%s resctrl mountpoint \"%s\" exists\n", dp ? "pass:" : "fail:", RESCTRL_PATH);
check_resctrlfs_support() does the following 1. Checks if the platform supports resctrl file system or not by looking for resctrl in /proc/filesystems 2. Calls opendir() on default resctrl file system path (i.e. /sys/fs/resctrl) 3. Checks if resctrl file system is mounted or not by looking at /proc/mounts Steps 2 and 3 will fail if the platform does not support resctrl file system. So, there is no need to check for them if step 1 fails. Fix this by returning immediately if the platform does not support resctrl file system. Signed-off-by: Fenghua Yu <fenghua.yu@intel.com> --- tools/testing/selftests/resctrl/resctrlfs.c | 3 +++ 1 file changed, 3 insertions(+)