Blame SOURCES/0001-stress-sysfs-check-for-zero-sysfs-entries-after-prun.patch

551471
From 6a22f648bd3452c83c5f88ec530d496fefe5e9a0 Mon Sep 17 00:00:00 2001
551471
From: Colin Ian King <colin.i.king@gmail.com>
551471
Date: Mon, 21 Nov 2022 12:16:47 +0000
551471
Subject: [PATCH 1/3] stress-sysfs: check for zero sysfs entries after pruning
551471
 the directory
551471
551471
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
551471
---
551471
 stress-sysfs.c | 18 +++++++++++-------
551471
 1 file changed, 11 insertions(+), 7 deletions(-)
551471
551471
diff --git a/stress-sysfs.c b/stress-sysfs.c
551471
index 00fe9ba08100..24267d00ee5a 100644
551471
--- a/stress-sysfs.c
551471
+++ b/stress-sysfs.c
551471
@@ -634,14 +634,11 @@ static int stress_sysfs(const stress_args_t *args)
551471
 	}
551471
 
551471
 	n = scandir("/sys", &dlist, NULL, alphasort);
551471
-	if (n <= 0) {
551471
-		if (args->instance == 0)
551471
-			pr_inf_skip("%s: no /sys entries found, skipping stressor\n", args->name);
551471
-		stress_dirent_list_free(dlist, n);
551471
-		(void)munmap((void *)ctxt, sizeof(*ctxt));
551471
-		return EXIT_NO_RESOURCE;
551471
-	}
551471
+	if (n <= 0)
551471
+		goto exit_no_sysfs_entries;
551471
 	n = stress_dirent_list_prune(dlist, n);
551471
+	if (n <= 0)
551471
+		goto exit_no_sysfs_entries;
551471
 
551471
 	os_release = 0;
551471
 #if defined(HAVE_UNAME) &&	\
551471
@@ -806,10 +803,17 @@ finish:
551471
 		(void)close(ctxt->kmsgfd);
551471
 	(void)shim_pthread_spin_destroy(&lock);
551471
 
551471
+exit_free:
551471
 	stress_dirent_list_free(dlist, n);
551471
 	(void)munmap((void *)ctxt, sizeof(*ctxt));
551471
 
551471
 	return rc;
551471
+
551471
+exit_no_sysfs_entries:
551471
+	if (args->instance == 0)
551471
+		pr_inf_skip("%s: no /sys entries found, skipping stressor\n", args->name);
551471
+	rc = EXIT_NO_RESOURCE;
551471
+	goto exit_free;
551471
 }
551471
 
551471
 stressor_info_t stress_sysfs_info = {
551471
-- 
551471
2.38.1
551471