[PATCH 3/5] lib: make igt_debugfs_open infallible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(Almost) no one cared anyway.
---
 lib/igt_debugfs.c       | 13 ++++++-------
 lib/igt_debugfs.h       |  2 +-
 tests/gem_reset_stats.c |  2 +-
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 32edc435e4bc..9c4c989c5437 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -37,7 +37,7 @@
 /*
  * General debugfs helpers
  */
-int igt_debugfs_init(igt_debugfs_t *debugfs)
+void igt_debugfs_init(igt_debugfs_t *debugfs)
 {
 	const char *path = "/sys/kernel/debug";
 	struct stat st;
@@ -51,11 +51,9 @@ int igt_debugfs_init(igt_debugfs_t *debugfs)
 	if (stat("/sys/kernel/debug/dri", &st) == 0)
 		goto find_minor;
 
-	if (stat("/sys/kernel/debug", &st))
-		return errno;
+	igt_assert(stat("/sys/kernel/debug", &st) == 0);
 
-	if (mount("debug", "/sys/kernel/debug", "debugfs", 0, 0))
-		return errno;
+	igt_assert(mount("debug", "/sys/kernel/debug", "debugfs", 0, 0) == 0);
 
 find_minor:
 	strcpy(debugfs->root, path);
@@ -64,12 +62,13 @@ find_minor:
 		sprintf(debugfs->dri_path + len, "/i915_error_state");
 		if (stat(debugfs->dri_path, &st) == 0) {
 			debugfs->dri_path[len] = '\0';
-			return 0;
+			return;
 		}
 	}
 
 	debugfs->dri_path[0] = '\0';
-	return ENOENT;
+
+	igt_fail(4);
 }
 
 int igt_debugfs_open(igt_debugfs_t *debugfs, const char *filename, int mode)
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index 43fa0fc504bf..5f940cb23e57 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -36,7 +36,7 @@ typedef struct {
 	char dri_path[128];
 } igt_debugfs_t;
 
-int igt_debugfs_init(igt_debugfs_t *debugfs);
+void igt_debugfs_init(igt_debugfs_t *debugfs);
 int igt_debugfs_open(igt_debugfs_t *debugfs, const char *filename, int mode);
 FILE *igt_debugfs_fopen(igt_debugfs_t *debugfs, const char *filename,
 			const char *mode);
diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
index a7d6550df07a..71ba6dfe1659 100644
--- a/tests/gem_reset_stats.c
+++ b/tests/gem_reset_stats.c
@@ -1041,7 +1041,7 @@ igt_main
 			      "Kernel is too old, or contexts not supported: %s\n",
 			      strerror(errno));
 
-		assert(igt_debugfs_init(&dfs) == 0);
+		igt_debugfs_init(&dfs);
 	}
 
 	igt_subtest("params")
-- 
1.8.5.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux