All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v1] zram03: unload zram when it is loaded during test run
@ 2022-09-05  7:43 Xiao Liang
  2022-09-05  9:15 ` Petr Vorel
  0 siblings, 1 reply; 4+ messages in thread
From: Xiao Liang @ 2022-09-05  7:43 UTC (permalink / raw)
  To: ltp; +Cc: xiliang

Signed-off-by: Xiao Liang <xiliang@redhat.com>
---
 testcases/kernel/device-drivers/zram/zram03.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/testcases/kernel/device-drivers/zram/zram03.c b/testcases/kernel/device-drivers/zram/zram03.c
index b9867a573..98eb61e1c 100644
--- a/testcases/kernel/device-drivers/zram/zram03.c
+++ b/testcases/kernel/device-drivers/zram/zram03.c
@@ -187,16 +187,15 @@ static void setup(void)
 
 	 /* zram module was built in or being used on old kernel */
 	SAFE_CMD(cmd_modprobe, NULL, NULL);
-	if (access(ZRAM_CONTROL_PATH, F_OK)) {
-		file = SAFE_FOPEN("/proc/modules", "r");
-		while (fgets(line, sizeof(line), file)) {
-			if (strstr(line, "zram")) {
-				modprobe = 1;
-				break;
-			}
+	file = SAFE_FOPEN("/proc/modules", "r");
+	while (fgets(line, sizeof(line), file)) {
+		if (strstr(line, "zram")) {
+			modprobe = 1;
+			break;
 		}
-		SAFE_FCLOSE(file);
-
+	}
+	SAFE_FCLOSE(file);
+	if (access(ZRAM_CONTROL_PATH, F_OK)) {
 		if (modprobe) {
 			tst_res(TINFO,
 				"rmmod zram before test on old kernel without zram-control interface");
-- 
2.37.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-05 12:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-05  7:43 [LTP] [PATCH v1] zram03: unload zram when it is loaded during test run Xiao Liang
2022-09-05  9:15 ` Petr Vorel
2022-09-05 10:15   ` Petr Vorel
2022-09-05 12:10     ` Frank Liang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.