[igt-dev] [PATCH i-g-t v3 6/6] tests/fbcon_fbt: Do not keep opening debugfs_fd at every setup_drm() call

José Roberto de Souza jose.souza at intel.com
Wed Apr 10 22:07:16 UTC 2019


As debugfs_fd is used even after the teardown_drm(), it is not closed
in this function or in any other place. And then it gets worse as
every call to setup_drm() will open another file descriptor to
debugfs dir.

So lets move the opening of debugfs_fd to setup_environment() and only
open it once and close it before leave the test.

Reviewed-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
---
 tests/kms_fbcon_fbt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/kms_fbcon_fbt.c b/tests/kms_fbcon_fbt.c
index 67117a24..d534abd2 100644
--- a/tests/kms_fbcon_fbt.c
+++ b/tests/kms_fbcon_fbt.c
@@ -64,7 +64,6 @@ static void setup_drm(struct drm_info *drm)
 		return;
 
 	drm->fd = drm_open_driver_master(DRIVER_INTEL);
-	drm->debugfs_fd = igt_debugfs_dir(drm->fd);
 
 	drm->res = drmModeGetResources(drm->fd);
 	igt_require(drm->res);
@@ -295,6 +294,7 @@ static void setup_environment(struct drm_info *drm)
 
 	drm_fd = drm_open_driver_master(DRIVER_INTEL);
 	igt_require(drm_fd >= 0);
+	drm->debugfs_fd = igt_debugfs_dir(drm_fd);
 	igt_assert(close(drm_fd) == 0);
 
 	/*
@@ -309,6 +309,8 @@ static void teardown_environment(struct drm_info *drm)
 {
 	if (drm->fd >= 0)
 		teardown_drm(drm);
+
+	close(drm->debugfs_fd);
 }
 
 igt_main
-- 
2.21.0



More information about the igt-dev mailing list