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

José Roberto de Souza jose.souza at intel.com
Wed Mar 27 20:03:31 UTC 2019


As debugfs_fd is used even after the teardown_drm() call, it do not
closes it causing it to open another debugfs_fd at every call to
setup_drm().
Let move the opening of debugfs_fd to setup_environment() and only
open it once, also lets close it before leave the test.

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 66f214c5..f7ff671b 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);
 
 	/*
@@ -311,6 +311,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