[igt-dev] [PATCH i-g-t 2/2] tools/intel_pm_rpm: Only init debufs_fd if needed.

Rodrigo Vivi rodrigo.vivi at intel.com
Mon Oct 31 19:58:59 UTC 2022


So we can run a --setup-d3cold without depending on the presence
of a debugfs.

Cc: Anshuman Gupta <anshuman.gupta at intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
---
 tools/intel_pm_rpm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/intel_pm_rpm.c b/tools/intel_pm_rpm.c
index 05d7f6fb..17cd2bc1 100644
--- a/tools/intel_pm_rpm.c
+++ b/tools/intel_pm_rpm.c
@@ -197,10 +197,9 @@ int main(int argc, char *argv[])
 		goto exit;
 	}
 
-	data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
-
 	data.res = drmModeGetResources(data.drm_fd);
 	if (data.res) {
+		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
 		kmstest_set_vt_graphics_mode();
 		igt_display_require(&data.display, data.drm_fd);
 
@@ -240,7 +239,8 @@ exit:
 	if (data.res)
 		igt_display_fini(&data.display);
 
-	close(data.debugfs_fd);
+	if (data.debugfs_fd)
+		close(data.debugfs_fd);
 	close(data.drm_fd);
 	igt_devices_free();
 
-- 
2.37.3



More information about the igt-dev mailing list