From: Fenghua Yu Date: Wed, 17 Mar 2021 02:22:46 +0000 (+0000) Subject: selftests/resctrl: Check for resctrl mount point only if resctrl FS is supported X-Git-Tag: v5.15~1269^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3611fbc6e58c147bdd409b356baf15ddf57271e;p=platform%2Fkernel%2Flinux-starfive.git selftests/resctrl: Check for resctrl mount point only if resctrl FS is supported 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. Tested-by: Babu Moger Signed-off-by: Fenghua Yu Signed-off-by: Shuah Khan --- diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c index 6b22a18..87195eb 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);