[igt-dev] [PATCH i-g-t v3 3/4] test: i915_pm_rpm: conditional initialization of igt_display_t

Anshuman Gupta anshuman.gupta at intel.com
Wed May 18 16:54:53 UTC 2022


Initialize igt_display_t display only in case of there are
valid drm kms resources.

v2:
- Move igt_display_fini under the 'if (data->res)' cond. [Ashutosh]

Signed-off-by: Anshuman Gupta <anshuman.gupta at intel.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
---
 tests/i915/i915_pm_rpm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
index b836656c29..a6035e60b8 100644
--- a/tests/i915/i915_pm_rpm.c
+++ b/tests/i915/i915_pm_rpm.c
@@ -406,9 +406,9 @@ static void init_mode_set_data(struct mode_set_data *data)
 		}
 
 		kmstest_set_vt_graphics_mode();
+		igt_display_require(&data->display, drm_fd);
 	}
 
-	igt_display_require(&data->display, drm_fd);
 	init_modeset_cached_params(&ms_data);
 }
 
@@ -420,9 +420,8 @@ static void fini_mode_set_data(struct mode_set_data *data)
 			drmModeFreePropertyBlob(data->edids[i]);
 		}
 		drmModeFreeResources(data->res);
+		igt_display_fini(&data->display);
 	}
-
-	igt_display_fini(&data->display);
 }
 
 static void get_drm_info(struct compare_data *data)
-- 
2.26.2



More information about the igt-dev mailing list